SetTimer - help about time
#1

When I typed /start , I start timer of 20 minutes. After that 20 minutes something stop. But that isnt problem

How to make when someone type /time.
To show how much time is left.

For example.

When someone type /time, comes SendClientMessage 19:37 left.
When someone type /time after two seconds SendClienMessage 19:35 left.
Reply
#2

You have to make a variable.

something like

pawn Код:
new LeftMinutes = 19;
new LeftSeconds = 50;
Then set a timer OnGameModeInit and decrease the LeftSeconds, Then check if the LeftSeconds is -1 then decrease the LeftMinutes, Just like a Clock System, But vice versa (Reverse)
Reply
#3

Dont know how to do it, can you help me more ? If I type
new LeftMinutes = 19;
new LeftSeconds = 50;

Only this, and later dont know what to type.
Where and how you set -1 seconds, and when -1 minutes ?
Reply
#4

BUMP*
Reply
#5

You should save the time, your hour and minute in a variable.
Can you show me your SetTimer and the public function of Timer?
Reply
#6

I didnt script anything about Timer. I ask you how to make that when I typed some command, it start "counting", so first time when type 2:58, after two seconds 2:56. Sory for bad english.
Reply
#7

At the top of script
Код:
new timeleft = 1200000 //(20minute)
Then create global timer with 1000ms. (SetTimer("global", 1000, 1));
And in global public

Код:
timeleft -= 1;
In command add

Код:
new str[16];
format(str, 16, "%d:%d left", timeleft, timeleft % 60
SendClientMessage(playerid, -1, str);
Don't forgot to reset 'timeleft' while time left!
This should work.
Reply
#8

Dont work, InGame it show me only number 9, after one seconds i type again and it show me 8, and again 8 and again 8...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)