CLEO Help Can't break the loop

CLEO related
Status
Not open for further replies.
Joined
Mar 17, 2020
Messages
19
Reaction score
2
Location
Narnia
Hi everybody, I've been trying to do a function which I could call it from my main code. The function is supposed to add a chat message with the nearest player name.
The problem I got is that I can't break the loop and the for loop goes on.
Here the piece of code:
Code:
{$CLEO .cs}

0000: NOP


repeat
    wait 0
until 0AFA:


:activation
wait 0
if and
0AB0: 109
not SAMP.ChatInputOpened($PLAYER_ACTOR)
jf @activation
call @playername
jump @activation

:playername
wait 0
0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 29@ += 0x4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
FOR 30@ = 0 to 35584 step 0x100
    0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
    000A: 29@ += 0x1
    IF AND
        0029:  31@ >= 0x00
        001B:  0x80 > 31@
    THEN
        005A: 31@ += 30@
            IF AND
            803B:   31@ == $PLAYER_ACTOR  // (int)
            056D:   actor 31@ defined
            THEN
                0B2B: samp 7@ = get_player_id_by_actor_handle 31@
                0B36: samp 15@ = get_player_nickname 7@
                0B2B: samp 16@ = get_player_id_by_actor_handle $PLAYER_ACTOR
                0B36: samp 17@ = get_player_nickname 16@
                00A0: store_actor $PLAYER_ACTOR position_to 8@ 9@ 10@
                00A0: store_actor 31@ position_to 11@ 12@ 13@
                0509: 14@ = distance_between_XY 8@ 9@ and_XY 11@ 12@
                IF
                14@ <= 6.0 /// If distance smaller 6 then... , max 300.
                THEN IF AND
                0AB0:   key_pressed 109
                not  SAMP.ChatInputOpened($PLAYER_ACTOR)
                THEN
                  chatmsg "%s got %s's protection." 0x33CC99 17@ 15@
                  wait 3000
                  END  
                END
           END
       END
   END
I'd like to have the possibility to call it.
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}

0000: NOP

repeat
    wait 0
until 0AFA:

while true
wait 0

if and
0AB0: 109
8B21:     samp not_chat_opened
then
    0AB1: @playername 0
    wait 1500 // anti spam
end

end

:playername
wait 0
0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 29@ += 0x4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
FOR 30@ = 0 to 35584 step 0x100
    0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
    000A: 29@ += 0x1
    IF AND
        0029:  31@ >= 0x00
        001B:  0x80 > 31@
    THEN
        005A: 31@ += 30@
            IF AND
            803B:   31@ == $PLAYER_ACTOR  // (int)
            056D:   actor 31@ defined
            THEN
                0B2B: samp 7@ = get_player_id_by_actor_handle 31@
                0B36: samp 15@ = get_player_nickname 7@
                0B2B: samp 16@ = get_player_id_by_actor_handle $PLAYER_ACTOR
                0B36: samp 17@ = get_player_nickname 16@
                00A0: store_actor $PLAYER_ACTOR position_to 8@ 9@ 10@
                00A0: store_actor 31@ position_to 11@ 12@ 13@
                0509: 14@ = distance_between_XY 8@ 9@ and_XY 11@ 12@
                IF
                14@ <= 6.0 /// If distance smaller 6 then... , max 300.
                THEN 
                    IF AND
                    0AB0:   key_pressed 109
                    8B21:     samp not_chat_opened
                    THEN
                        chatmsg "%s got %s's protection." 0x33CC99 17@ 15@
                        wait 3000
                    END  
                END
           END
       END
   END
END
0AB2: ret 0
 
Status
Not open for further replies.
Top