CLEO Help how to add loop to script

CLEO related
Status
Not open for further replies.

zaketej

Member
Joined
Jan 2, 2019
Messages
24
Reaction score
2
Location
@Parazitas is our God
Code:
                                        {$CLEO}
0000: NOP
while not SAMP.Available()
  wait 400
end

while true
    wait 0
    if and
        0AB0: is_key_pressed 17 //ctrl
        0AB0: is_key_pressed 87 //w
    then
        if
            call @is_cp_active 0   
        then
            call @get_cp_pos 0 X 1@ Y 2@ Z 3@
            0603: task_go_to_coord_any_means $PLAYER_ACTOR coord 1@ 2@ 3@ walk_speed 7 car -1
            wait 2000 
        end 
    end
end

//Credits to Springfield and 0B36 for the 2 scm funcs
//http://ugbase.eu/index.php?threads/snippet-sa-mp-checkpoints.10260/post-72843
:is_cp_active
IF 0AA2: 0@ = loadlib "samp.dll"
THEN 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@
END
0AB2: ret 0

:get_cp_pos
IF 0AA2: 0@ = loadlib "samp.dll"
THEN 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@
END
0AB2: ret 3 2@ 3@ 4@

how could I add loop to this script?
This script is made by @ItsRobinson
 

ItsRobinson

Active member
Joined
Nov 16, 2017
Messages
105
Reaction score
20
PHP:
{$CLEO}
0000: NOP
while not SAMP.Available()
  wait 400
end

31@ = false

while true
    wait 0
    if and
        0AB0: is_key_pressed 17 //ctrl
        0AB0: is_key_pressed 87 //w
    then
        if
            31@ == true
        then 
            31@ = false
            chatmsg "autowalk: {FF0000}DISABLED" -1
            wait 2000
        else
            31@ = true
            chatmsg "autowalk: {00FF00}ENABLED" -1
            wait 2000
        end
    end
    if
        31@ == true
    then
        repeat
            wait 100
            if and
                0AB0: is_key_pressed 17 //ctrl
                0AB0: is_key_pressed 87 //w
            then
                if
                    31@ == true
                then 
                    31@ = false
                    chatmsg "autowalk: {FF0000}DISABLED" -1
                    wait 2000
                    BREAK
                else
                    31@ = true
                    chatmsg "autowalk: {00FF00}ENABLED" -1
                    wait 2000
                end
            end
        until call @is_cp_active 0
        if
            call @is_cp_active 0   
        then
            call @get_cp_pos 0 X 1@ Y 2@ Z 3@
            0603: task_go_to_coord_any_means $PLAYER_ACTOR coord 1@ 2@ 3@ walk_speed 7 car -1
            wait 2000 
        end
    end
end

//Credits to Springfield and 0B36 for the 2 scm funcs
//http://ugbase.eu/index.php?threads/snippet-sa-mp-checkpoints.10260/post-72843
:is_cp_active
IF 0AA2: 0@ = loadlib "samp.dll"
THEN 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@
END
0AB2: ret 0

:get_cp_pos
IF 0AA2: 0@ = loadlib "samp.dll"
THEN 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@
END
0AB2: ret 3 2@ 3@ 4@

It ain't perfect, but it's 4AM and it works :wegotabadass:
 
Status
Not open for further replies.
Top