Help Loop freezing game

Joined
Nov 7, 2017
Messages
8
Likes
0
Points
1
1
#1
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
 
Joined
Jun 6, 2018
Messages
16
Likes
0
Points
1
1
#2
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 [email protected] == 1
then
wait 2000
0af8: "Chatmsg every 2 seconds" -1
end
END

:loop
wait 0
[email protected] = 1
samp.cmdret

:stoploop
wait 0
[email protected] = 0
samp.CmdRet
 

Edvincik

Well-Known Member
Joined
Mar 15, 2016
Messages
337
Likes
1
Points
33
#3
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
[email protected] = FALSE

WHILE TRUE
WAIT 0
IF
[email protected] == TRUE
THEN
0af8: "Chatmsg every 2 seconds" -1
WAIT 2000
END
END

:LOOP
0B12: [email protected] = [email protected] XOR TRUE
IF
[email protected] == 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]
 
Top