CLEO Help Loop freezing game

CLEO related
Status
Not open for further replies.

JegaTurn

Active member
Joined
Nov 7, 2017
Messages
27
Reaction score
0
Hi, someone can explain to me why this loop is freezing game and just cursor can move? Thank you


Code:
{$CLEO}
0000:
 
REPEAT
   WAIT 100
UNTIL 0AFA: SAMP_IS_READY
                                         
0B34: samp register_client_command "loop" to_label @loop
 
WHILE TRUE
   WAIT 0 
END

:loop
wait 2000
0af8: "Chatmsg every 2 seconds" -1
jump @loop
 

hahahafuccoff

Member
Joined
Jun 6, 2018
Messages
16
Reaction score
0
Try this

{$CLEO}
0000:

REPEAT
 WAIT 100
UNTIL 0AFA: SAMP_IS_READY
                                       
0B34: samp register_client_command "loop" to_label @loop
0B34: samp register_client_command "stoploop" to_label @stoploop

WHILE TRUE
 WAIT 0
if 1@ == 1
then
wait 2000
0af8: "Chatmsg every 2 seconds" -1
end
END

:loop
wait 0
1@ = 1
samp.cmdret

:stoploop
wait 0
1@ = 0
samp.CmdRet
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
JegaTurn said:
Hi, someone can explain to me why this loop is freezing game and just cursor can move? Thank you


Code:
{$CLEO}
0000:
 
REPEAT
   WAIT 100
UNTIL 0AFA: SAMP_IS_READY
                                         
0B34: samp register_client_command "loop" to_label @loop
 
WHILE TRUE
   WAIT 0 
END

:loop
wait 2000
0af8: "Chatmsg every 2 seconds" -1
jump @loop

You are using 0B34 in wrong way, your code should look smth like this:

[shcode=cpp]
{$CLEO}
0000:

REPEAT
WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "loop" to_label @LOOP
0@ = FALSE

WHILE TRUE
WAIT 0
IF
0@ == TRUE
THEN
0af8: "Chatmsg every 2 seconds" -1
WAIT 2000
END
END

:LOOP
0B12: 0@ = 0@ XOR TRUE
IF
0@ == TRUE
THEN
0ACD: show_text_highpriority "Loop ~g~started" time 1000
ELSE
0ACD: show_text_highpriority "Loop ~r~stopped" time 1000
END
0B43: samp cmd_ret
[/shcode]
 
Status
Not open for further replies.
Top