CLEO Help Help 0001: wait

CLEO related
Status
Not open for further replies.

SpuDy

New member
Joined
Apr 12, 2017
Messages
3
Reaction score
0
Hellow, i made a simple cleo mod for samp, for in game commands and I need this:

:cmd_52
SAMP.IsCommandTyped(20@)
    0AF9: samp say_msg "/d FVR Federal Bureau Of Investigations in 5 secunde"
wait 5000
    0AF9: samp say_msg "/fvrespawn"
SAMP.CmdRet()

Yes, but my 'wait 5000' doesn't work, what i can do?
I must wait 5 seconds between commands.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
hi, it doesn't work because it's in command callback, you could try something like this:


Code:
while true 
wait 0
    if 31@ == true
    then
        31@ = false
        0AF9: samp say_msg "/d FVR Federal Bureau Of Investigations in 5 secunde"
        wait 5000
        0AF9: samp say_msg "/fvrespawn"
    end
end



:cmd_52
31@ = true
samp.CmdRet()
 

SpuDy

New member
Joined
Apr 12, 2017
Messages
3
Reaction score
0
Thx, but i'm a beginner and i dont know how to put you code in command, can you show me the entire command from :cmd_52 to samp.cmdret() pls?

I did that

Code:
:cmd_52
SAMP.IsCommandTyped(20@)
while true 
wait 0
   if 31@ == true
   then
       31@ = false
       0AF9: samp say_msg "/d FVR Federal Bureau Of Investigations in 5 secunde"
       wait 5000
       0AF9: samp say_msg "/fvrespawn"
   end
end



:cmd_52
31@ = true
samp.CmdRet()
But it didn't work
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
just tested it with cleo 4.1, samp 0.3.7 and sampfuncs 5.3.1

Code:
{$CLEO .cs}
0000: NOP

repeat
wait 50
until 0AFA: is_samp_structures_available

0B34: samp register_client_command "mycmd" to_label @cmd_callback

while true 
wait 0
    if 31@ == true
    then
        31@ = false
        0AF9: samp say_msg "/d FVR Federal Bureau Of Investigations in 5 secunde"
        wait 5000
        0AF9: samp say_msg "/fvrespawn"
    end
end

:cmd_callback
31@ = true
samp.CmdRet()

the command just changes the value of 31@ variable to "true", then it is noticed in the main loop ("while true - end") and the action is undertaken (31@ variable is set back to "false" to prevent constantly triggering the action)

You could check this out to understand how command-related instructions (samp.cmdRet, 0B34 opcode) behave
http://ugbase.eu/Thread-Crash-when-execute-custom-command?pid=101425#pid101425
 
Status
Not open for further replies.
Top