CLEO Help help beginner

CLEO related
Status
Not open for further replies.

ernesto

Member
Joined
Dec 24, 2013
Messages
8
Reaction score
0
I am trying to compile a code but it is not working.

Code:
ncorrect expression 1@ = SAMP.GetSAMPPlayerIDByActorHandle(0@).
One of the variables has unknown type, or operands are incompatible.

HALP
 

ernesto

Member
Joined
Dec 24, 2013
Messages
8
Reaction score
0
Thank you a lot, now it is compiling pretty well.

Now, would you mind giving me a hand with this code?

Code:
{$CLEO}
0000: NOP

:MAIN
wait 0
if
0AB0: 49
jf @MAIN 
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to $NOT_USED closest_ped_to 0@
if
056D:   actor 0@ defined
jf @MAIN
1@ = SAMP.GetSAMPPlayerIDByActorHandle(0@)
0AF9: "/rob %d" 1@

:STOP_UNTIL_RELEASING_BUTTON
wait 0
if
8AB0: 49
jf @STOP_UNTIL_RELEASING_BUTTON
goto @MAIN

http://ugbase.eu/help-7/getting-the-id-of-the-nearest-player/

I copied it from this thread and the problem is that it crashes everytime I press the keybind. I simply need a code like this that gets the ID of neareast player and sends a message like this /rob [id of the nearest player].

Any idea?
 

0B36

Expert
Joined
Jan 6, 2014
Messages
1,324
Reaction score
8
Code:
{$CLEO}

thread "id"

repeat
wait 0
until SAMP.Available()

while true
wait 0
        if
            0AB0: 49
        then
            0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@
            if
                056D: actor 1@ defined
            then
                2@ = SAMP.GetSAMPPlayerIDByActorHandle(1@)
                0AF9: "/rob %d" 2@
            end
         end
end
 

ernesto

Member
Joined
Dec 24, 2013
Messages
8
Reaction score
0
ıllıllı 0β36 ıllıllı link said:
Code:
{$CLEO}

thread "id"

repeat
wait 0
until SAMP.Available()

while true
wait 0
        if
            0AB0: 49
        then
            0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@
            if
                056D: actor 1@ defined
            then
                2@ = SAMP.GetSAMPPlayerIDByActorHandle(1@)
                say "/rob %d" 2@
            end
         end
end

Code:
Unknown Directive say "/rob %d" 2@

I am new to this, hope you don't get annoyed, lol.

What is this error?
 

0B36

Expert
Joined
Jan 6, 2014
Messages
1,324
Reaction score
8
say is a keyword used for opcode 0AF9, keywords make it easy and you don't have to remember the opcode itself, everytime you need to make use of it.

You don't seem to have that keyword listed in the keyword database stored in the keywords.txt file. So replace say with 0AF9: instead.
 

ernesto

Member
Joined
Dec 24, 2013
Messages
8
Reaction score
0
Oh ye, I checked that keyword text file and saw this say_msg and replaced it but once I join game, my game crashes. Any idea?

(appreciate your help a lot)
 

ernesto

Member
Joined
Dec 24, 2013
Messages
8
Reaction score
0
Okay, I found out the sampfuncs 3.2 weren't workin for me, so I downloaded new ones for samp 0.3.7 which was 5.2.1

Apparently, it doesn't crash me on loading but when I press the key to execute the cleo, it just spams the chat like 10 times and never robs the closest player.
 

0B36

Expert
Joined
Jan 6, 2014
Messages
1,324
Reaction score
8
sampfuncs 3.2 is for 0.3z, obviously you need the latest version. Read the damn sampfuncs thread.

Don't hold the key, press once and it's a command, it can't spam the chat in any way. It only sends the command /rob ID, rest is done via the server not through the CLEO, so CLEO works just fine.
 

ernesto

Member
Joined
Dec 24, 2013
Messages
8
Reaction score
0
I changed the command to /rob [ID] 5000, which is the command at the server I play. I only pressed once and it was spamming it but it never caught any ID for me, cos server has anti-spam.

Yes, I did update to sampfucns 5.2.1 but still, the key was kinda getting spammed
 
Status
Not open for further replies.
Top