18.12.2016, 22:47
Hey there,
I've recently been working on a robbery script to work alongside my store system. It all went well, except for one thing.
The timer would go much slower than set.
The timer is used to countdown how many seconds the player has left until they complete the robbery. It is set for a one second lapse, but instead it takes around 20 seconds to do one second.
I'm not quite sure what's wrong.
Could someone please help?
Thanks!
I've recently been working on a robbery script to work alongside my store system. It all went well, except for one thing.
The timer would go much slower than set.
Код:
//top of my script #define ROBBERY_COUNTDOWN (15) //The time it takes for a player to complete a robbery new timeLeft[ MAX_PLAYERS ] = ROBBERY_COUNTDOWN, robTimer[ MAX_PLAYERS ];
Код:
//when a player starts a robbery robTimer[playerid] = SetTimerEx("StoreRobbery", 1000, true, "i", playerid);
Код:
// timer itself public StoreRobbery( playerid ) { TimeLeft[playerid] --; if( TimeLeft[ playerid ] > 0 ) { //code here } else { //code here KillTimer(robTimer[playerid]); } printf("%d", timeLeft[playerid]); //debug return 1; }
I'm not quite sure what's wrong.
Could someone please help?
Thanks!