CLEO Help place waypoint

CLEO related

davidel

Well-known member
Joined
Jan 17, 2020
Messages
207
Reaction score
7
Location
Germania
i need some help with the waypoints
Explanation:
waypoint = marker
i have a LUA file which teleports me to the waypoint (RMB click on the map - that marker), but i need to teleport into a checkpoint and it will take a lot of time if i place the waypoiint manually.

maybe this will help
Code:
{
    call @getTargetMarkerHandle 0 returnTo: 0@
}
:getTargetMarkerHandle
0A8D: 0@ = read_memory 0xBA6774 size 4 virtual_protect 0
ret 1 0@

{
    call @setStateTargetMarker 1 state 0
}
:setStateTargetMarker
call @getTargetMarkerHandle 0 return: 1@
if 1@ > 0
then
    if 0@ == 0
    then
        0AA5: call_function 0x587CE0 num_params 1 pop 1 1@ // CRadar::removeBlip         
        0A8C: write_memory 0xBA6774 size 4 value 0 virtual_protect 0 // CMenuManager::m_targetMarker
    end
else
    if 0@ == 1
    then
        0AA7: call_function 0x583820 num_params 6 pop 6 2 0 0 0 0 4 1@ // CRadar::createBlip
        0AA5: call_function 0x583D70 num_params 2 pop 2 41 1@ // CRadar::setBlipSprite
        0A8C: write_memory 0xBA6774 size 4 value 1@ virtual_protect 0 // CMenuManager::m_targetMarker
    end
end
ret 0

{
    call @setTargetMarkerPosition 3 x 1@ y 2@ z 3@
}
:setTargetMarkerPosition
call @getTargetMarkerHandle 0 return: 3@
if 075C: marker 3@ enabled
then
    0B10: 4@ = 3@ AND 0xFFFF
    0012: 4@ *= 40
    0A8E: 5@ = 0xBA86F8 + 4@
    0A8C: write_memory 5@ size 4 value 1@ virtual_protect 0
    5@ += 4
    0A8C: write_memory 5@ size 4 value 2@ virtual_protect 0
    5@ += 4
    0A8C: write_memory 5@ size 4 value 3@ virtual_protect 0
end     
0AB2: ret 0

i want when i type /placemarkk to place a waypoint in the checkpoint position and after i reach that position to place the character inside of the checkpoint
 

davidel

Well-known member
Joined
Jan 17, 2020
Messages
207
Reaction score
7
Location
Germania
Code:
{$CLEO .cs}
thread "exam"
wait 0

while true
    wait 0
    if 0AB0:   key_pressed 89

    then
          actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)
          wait 1000
          chatmsg "coord x %f" -1 0@
          wait 1000  
         0AF8: samp add_message_to_chat "xputfirst %f" color -1 0@
    wait 1000
          0AF8: samp add_message_to_chat "yputfirst %f" color -1 1@
    wait 1000
           0AF8: samp add_message_to_chat "zputfirst %f" color -1 2@
    wait 1000
        call @setStateTargetMarker 1 state 1
     
        call @get_cp_pos 0 1@ 2@ 3@
         0AF8: samp add_message_to_chat "x %f" color -1 1@
    wait 1000                                            
          0AF8: samp add_message_to_chat "y %f" color -1 2@
    wait 1000
           0AF8: samp add_message_to_chat "z %f" color -1 3@
    wait 1000
        call @setTargetMarkerPosition 3 1@ 2@ 20.0
         0AF8: samp add_message_to_chat "xSet %f" color -1 1@
    wait 1000
          0AF8: samp add_message_to_chat "ySet %f" color -1 2@
    wait 1000
        0AB6: store_target_marker_coords_to 1@ 2@ 3@
        wait 1000
        0AF8: samp add_message_to_chat "xmarkcoord %f" color -1 1@
        wait 1000
        0AF8: samp add_message_to_chat "ymarkcoord %f" color -1 2@
        wait 1000
        0AF8: samp add_message_to_chat "zmarkcoord %f" color -1 3@
        wait 1000
        actor.PutAt($PLAYER_ACTOR, 1@, 2@, 3@)
        wait 1000
         0AF8: samp add_message_to_chat "xPut %f" color -1 1@
    wait 1000
          0AF8: samp add_message_to_chat "yPut %f" color -1 2@
    wait 1000
           0AF8: samp add_message_to_chat "zPut %f" color -1 3@
    wait 1000
      
        {call @get_cp_pos 0 1@ 2@ 3@
        0AB6: store_target_marker_coords_to 1@ 2@ 3@ // IF and SET
        call @setStateTargetMarker 1 state 1
        if
        044B: $PLAYER_ACTOR   
        then
        call @setTargetMarkerPosition 3 x 1@ y 2@ z 3@
        }        
    end
    end


{
    call @getTargetMarkerHandle 0 returnTo: 0@
}
:getTargetMarkerHandle
0A8D: 0@ = read_memory 0xBA6774 size 4 virtual_protect 0
ret 1 0@

{
    call @setStateTargetMarker 1 state 0
}
:setStateTargetMarker
call @getTargetMarkerHandle 0 return: 1@
if 1@ > 0
then
    if 0@ == 0
    then
        0AA5: call_function 0x587CE0 num_params 1 pop 1 1@ // CRadar::removeBlip       
        0A8C: write_memory 0xBA6774 size 4 value 0 virtual_protect 0 // CMenuManager::m_targetMarker
    end
else
    if 0@ == 1
    then
        0AA7: call_function 0x583820 num_params 6 pop 6 2 0 0 0 0 4 1@ // CRadar::createBlip
        0AA5: call_function 0x583D70 num_params 2 pop 2 41 1@ // CRadar::setBlipSprite
        0A8C: write_memory 0xBA6774 size 4 value 1@ virtual_protect 0 // CMenuManager::m_targetMarker 
    end
end
ret 0

{
    call @setTargetMarkerPosition 3 x 1@ y 2@ z 3@
}
:setTargetMarkerPosition
call @getTargetMarkerHandle 0 return: 3@
if 075C: marker 3@ enabled
then
    0B10: 4@ = 3@ AND 0xFFFF
    0012: 4@ *= 40
    0A8E: 5@ = 0xBA86F8 + 4@
    0A8C: write_memory 5@ size 4 value 1@ virtual_protect 0
    5@ += 4
    0A8C: write_memory 5@ size 4 value 2@ virtual_protect 0
    5@ += 4
    0A8C: write_memory 5@ size 4 value 3@ virtual_protect 0
end   
0AB2: ret 0 

:get_cp_pos
0AA2: 0@ = loadlib "samp.dll"
0A8E: 1@ = 0@ + 0x21A10C
0A8D: 1@ = readMem 1@ sz 4 vp 0
1@ += 0xC
0A8D: 2@ = readMem 1@ sz 4 vp 0
1@ += 0x4
0A8D: 3@ = readMem 1@ sz 4 vp 0
1@ += 0x4
0A8D: 4@ = readMem 1@ sz 4 vp 0
0AA3: freelib 0@
0AB2: ret 3 2@ 3@ 4@


:is_cp_active
0AA2: 0@ = loadlib "samp.dll"
0A8E: 1@ = 0@ + 0x21A10C
0A8D: 1@ = readMem 1@ sz 4 vp 0
1@ += 0x24
0A8D: 1@ = readMem 1@ sz 4 vp 0
IF 1@ == TRUE
THEN 0485:  return_true
ELSE 059A:  return_false
END
0AA3: freelib 0@
0AB2: ret 0

why it is not placing the waypoint right? the checkpoint and the waypoint will be in different locations.. what i didn't do right?



///edit
the problem is here i think
Code:
:setTargetMarkerPosition

call @getTargetMarkerHandle 0 return: 3@

if 075C: marker 3@ enabled

then

    0B10: 4@ = 3@ AND 0xFFFF

    0012: 4@ *= 40

    0A8E: 5@ = 0xBA86F8 + 4@

    0A8C: write_memory 5@ size 4 value 1@ virtual_protect 0

    5@ += 4

    0A8C: write_memory 5@ size 4 value 2@ virtual_protect 0

    5@ += 4

    0A8C: write_memory 5@ size 4 value 3@ virtual_protect 0

end 

0AB2: ret 0
the coords are good, but i think the script is f..ked because it says that the marker somhehow it s placed in the right coords, but he is not..

this is the debug


x 1219.612915 - coord x where the checkpoint is
y -1814.285400 - coord y where the checkpoint is
z 16.593800 - coord z where the checkpoint is
xSet 1219.612915 - this is the x coord of the checkpoint and says that the marker is placed in the coord x of the checkpoint
ySet -1814.285400 - this is the y coord of the checkpoint and says that the marker is placed in the coord y of the checkpoint
xmarkcoord -1814.285400 - this is the x coord of the waypoint (it should be 1219.612915 but i dont know why it is changed)
ymarkcoord 20.000000 - this is the y coord of the waypoint (it should be -1814.285400 but i dont know why it is changed)
zmarkcoord 20.000000 - z coord waypoint


what is wrong??
 
Last edited:
Top