Issue with timer
#1

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.


Код:
//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;
}
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!
Reply


Messages In This Thread
Issue with timer - by FunnyBear - 18.12.2016, 22:47
Re: Issue with timer - by Luicy. - 19.12.2016, 00:05
Re: Issue with timer - by FunnyBear - 19.12.2016, 01:35
Re: Issue with timer - by Lordzy - 19.12.2016, 07:00
Re: Issue with timer - by Luicy. - 19.12.2016, 08:18
Re: Issue with timer - by FunnyBear - 19.12.2016, 12:11
Re: Issue with timer - by Lordzy - 19.12.2016, 12:26
Re: Issue with timer - by SickAttack - 19.12.2016, 13:45
Re: Issue with timer - by Lordzy - 19.12.2016, 14:09
Re: Issue with timer - by SickAttack - 19.12.2016, 14:11

Forum Jump:


Users browsing this thread: 1 Guest(s)