View Full Version : Long timers question

10/02/2017, 01:07 AM
Hey guys, can you help me with some links regarding long timers or some examples?

For example, I want to make a drug system, and there is a medical drug that will hold off the drug effect for 4 hours?

Do I make something like this?:
new drugtimer[MAX_PLAYERS] = 60;

And a timer that will lower it by 1 every minute?

10/02/2017, 01:41 AM
I think you could use a timestamp. You could do something like this:

On getting drug effect:
DrugTimeStamp[playerid] = gettime() + 14400; // thats 4hours in seconds
Druged[playerid] = 1;
Then if you have a global timer in the server you could do something like this:
public MinuteTimer()
foreach(new i : Player)
if(Druged[playerid] == 1)
if(DrugTimeStamp[i] < gettime())
//Wear off the drugs
return 1;

Though if you did this and the player disconnected, and connected 5 hours later the drugs would have worn off. (Also sorry for messy code)