CLEO Help 2 timers in one while true CMD - Sanny Builder

CLEO related
Status
Not open for further replies.

MTM

Member
Joined
Nov 6, 2018
Messages
6
Reaction score
0
Hello, I kept trying to somehow make 2 timers work in the same cmd, but it doesn't work, and if I put both of them in one "while true", the seconds from both stopwatches don't work anymore. What is to be done in this situation? This cmd is for the News Reporters faction and is compiled in the Sanny Builder program.
 

Attachments

  • ESHelp - CMD (News Reporters).cs
    161.4 KB · Views: 3

MTM

Member
Joined
Nov 6, 2018
Messages
6
Reaction score
0
-so if I add a single timer to this "while true" that timer works for seconds, but if I add both, neither works to work the seconds.
-The code for timers:

WHILE TRUE
WAIT 0

// - NRHelp - //
if 30@ > -1
then
0085: 29@ = 30@
if 30@ >= 180
then 0C50: samp textdraw 44 set_string "~W~3m:00s ~P~for next NEWS"
else
if 30@ >= 120
then
29@ -= 60
if 29@ > 60
then
29@ -= 60
0AD3: 28@ = "~W~2m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else
if 29@ == 60
then 0C50: samp textdraw 44 set_string "~W~2m:00s ~P~for next NEWS"
end
end
else
if 30@ >= 60
then
29@ -= 60
if 29@ > 0
then
0AD3: 28@ = "~W~1m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else 0C50: samp textdraw 44 set_string "~W~1m:00s ~P~for next NEWS"
end
else
0AD3: 28@ = "~W~%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
if 30@ == 0
then
0C50: samp textdraw 44 set_string "Ready"
gosub @NEWSHideTD
chatmsg "{C2A2DA}ES Timer {00FFFF}Now you can publish a new ad, if you want." -1
30@ = -1
29@ = -1
end
end
end
end

if $Tester_secunde > -1
then
if $Tester_secunde >= 60
then 0C50: samp textdraw 44 set_string "~W~1m:00s ~G~Tester Timer"
else
if $Tester_secunde >= 0
then
if $Tester_secunde > 0
then
0AD3: $Tester_secunde_Memory = "~W~%00ds ~G~Tester Timer" $Tester_secunde
0C50: samp textdraw 44 set_string $Tester_secunde_Memory
else
if $Tester_secunde == 0
then
0C50: samp textdraw 44 set_string "Ready"
gosub @TESTERHideTD
chatmsg "{C2A2DA}ES Timer{00FFFF}-{008000}Tester: {00FF00}The time for answering the question has expired!" -1
$Tester_secunde = -1
end
end
end
end

if 30@ > -1
then 30@ -= 1
end

if $Tester_secunde > -1
then $Tester_secunde -= 1
end
wait 1000
end
end

-This is how a single timer works:
if 30@ > -1
then
0085: 29@ = 30@
if 30@ >= 180
then 0C50: samp textdraw 44 set_string "~W~3m:00s ~P~for next NEWS"
else
if 30@ >= 120
then
29@ -= 60
if 29@ > 60
then
29@ -= 60
0AD3: 28@ = "~W~2m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else
if 29@ == 60
then 0C50: samp textdraw 44 set_string "~W~2m:00s ~P~for next NEWS"
end
end
else
if 30@ >= 60
then
29@ -= 60
if 29@ > 0
then
0AD3: 28@ = "~W~1m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else 0C50: samp textdraw 44 set_string "~W~1m:00s ~P~for next NEWS"
end
else
0AD3: 28@ = "~W~%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
if 30@ == 0
then
0C50: samp textdraw 44 set_string "Ready"
gosub @NEWSHideTD
chatmsg "{C2A2DA}ES Timer {00FFFF}Now you can publish a new ad, if you want." -1
30@ = -1
29@ = -1
end
end
end
end
if 30@ > -1
then 30@ -= 1
end
wait 1000
end
 

Attachments

  • Timer News.PNG
    Timer News.PNG
    10 KB · Views: 3
  • Timer Tester.PNG
    Timer Tester.PNG
    9 KB · Views: 3

Parazitas

God
Joined
Jan 2, 2017
Messages
3,103
Solutions
5
Reaction score
882
Location
Lithuania
First of all, let's learn how to use code functions in forum.

Examples below and in picture:

PHP:
My code using PHP Code function

Code:
My code using Code function
 

Attachments

  • Screenshot_20240303_155729_com.android.chrome.jpg
    Screenshot_20240303_155729_com.android.chrome.jpg
    279.8 KB · Views: 4

Parazitas

God
Joined
Jan 2, 2017
Messages
3,103
Solutions
5
Reaction score
882
Location
Lithuania
-so if I add a single timer to this "while true" that timer works for seconds, but if I add both, neither works to work the seconds.
-The code for timers:

WHILE TRUE
WAIT 0

// - NRHelp - //
if 30@ > -1
then
0085: 29@ = 30@
if 30@ >= 180
then 0C50: samp textdraw 44 set_string "~W~3m:00s ~P~for next NEWS"
else
if 30@ >= 120
then
29@ -= 60
if 29@ > 60
then
29@ -= 60
0AD3: 28@ = "~W~2m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else
if 29@ == 60
then 0C50: samp textdraw 44 set_string "~W~2m:00s ~P~for next NEWS"
end
end
else
if 30@ >= 60
then
29@ -= 60
if 29@ > 0
then
0AD3: 28@ = "~W~1m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else 0C50: samp textdraw 44 set_string "~W~1m:00s ~P~for next NEWS"
end
else
0AD3: 28@ = "~W~%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
if 30@ == 0
then
0C50: samp textdraw 44 set_string "Ready"
gosub @NEWSHideTD
chatmsg "{C2A2DA}ES Timer {00FFFF}Now you can publish a new ad, if you want." -1
30@ = -1
29@ = -1
end
end
end
end

if $Tester_secunde > -1
then
if $Tester_secunde >= 60
then 0C50: samp textdraw 44 set_string "~W~1m:00s ~G~Tester Timer"
else
if $Tester_secunde >= 0
then
if $Tester_secunde > 0
then
0AD3: $Tester_secunde_Memory = "~W~%00ds ~G~Tester Timer" $Tester_secunde
0C50: samp textdraw 44 set_string $Tester_secunde_Memory
else
if $Tester_secunde == 0
then
0C50: samp textdraw 44 set_string "Ready"
gosub @TESTERHideTD
chatmsg "{C2A2DA}ES Timer{00FFFF}-{008000}Tester: {00FF00}The time for answering the question has expired!" -1
$Tester_secunde = -1
end
end
end
end

if 30@ > -1
then 30@ -= 1
end

if $Tester_secunde > -1
then $Tester_secunde -= 1
end
wait 1000
end
end

-This is how a single timer works:
if 30@ > -1
then
0085: 29@ = 30@
if 30@ >= 180
then 0C50: samp textdraw 44 set_string "~W~3m:00s ~P~for next NEWS"
else
if 30@ >= 120
then
29@ -= 60
if 29@ > 60
then
29@ -= 60
0AD3: 28@ = "~W~2m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else
if 29@ == 60
then 0C50: samp textdraw 44 set_string "~W~2m:00s ~P~for next NEWS"
end
end
else
if 30@ >= 60
then
29@ -= 60
if 29@ > 0
then
0AD3: 28@ = "~W~1m:%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
else 0C50: samp textdraw 44 set_string "~W~1m:00s ~P~for next NEWS"
end
else
0AD3: 28@ = "~W~%02ds ~P~for next NEWS" 29@
0C50: samp textdraw 44 set_string 28@
if 30@ == 0
then
0C50: samp textdraw 44 set_string "Ready"
gosub @NEWSHideTD
chatmsg "{C2A2DA}ES Timer {00FFFF}Now you can publish a new ad, if you want." -1
30@ = -1
29@ = -1
end
end
end
end
if 30@ > -1
then 30@ -= 1
end
wait 1000
end

Second.

Cleo have two variables which is built-in timers.:
31@ and 32@

I would recommend use count down snippet if you planing to have only two timers

 
Status
Not open for further replies.
Top