CLEO Help [SOLVED] weird behavior

CLEO related
Status
Not open for further replies.

Kelsi235

Active member
Joined
Jun 2, 2019
Messages
53
Reaction score
4
0B34: samp register_client_command "autonews" to_label @toggle
33@ = true


:toggle
if
33@ == false
then
33@ = true
0AF8: samp add_message_to_chat "[/news] Toggled on!" color 0xFFFFFF
else
33@ = false
0AF8: samp add_message_to_chat "[Auto /news]Toggled off!" color 0xFFFFFF
end
samp.CmdRet


every time cmd autonews is written i get
// 0AF8: samp add_message_to_chat "[Auto /news]Toggled off!" color 0xFFFFFF
no matter how many times i write it
 

Kelsi235

Active member
Joined
Jun 2, 2019
Messages
53
Reaction score
4
PS

FOR ANYONE VIEWING THIS IN FUTURE
DON'T USE 33@ 32@ 31@

thx for parazitas for pointing this out in discord pms
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
https://gtaforums.com/topic/403594-sa-~-cleo-script-tutorial-~/
The local variables 32@ and 33@ are reserved for using in time checks
Its values are permanently counting ascending in milliseconds
They are allways integer values
We can restore the counting by setting the variable to zero

So if you set 32@ or 33@ to 0, it will automatically increase by 1 per milisecond (1000 per second). You can use it to measure time like this:

Code:
32@ = 0
while true
    if 32@ > 1000
    then
        // 1 second passed
        32@ = 0     // reset timer
    end
end
 
Status
Not open for further replies.
Top