Time based commands? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Time based commands? (
/showthread.php?tid=366314)
Time based commands? -
Makaveli93 - 06.08.2012
I'm planning to make a cop suspension command, for a certain amount of days/weeks. Now I'm wondering, what's the most efficient way to do it.
I already have weapon licenses with a time system (they're valid one month) and I store day, month and year in a player variable and player's user file (I use gettime() ).
Is there a more efficient way to do this, so I don't have to use 3 variables just for one thing?
Re: Time based commands? -
Jstylezzz - 06.08.2012
i think this is the fastest way.. i can't think of another way than the gettime() way..
Re: Time based commands? -
Ranama - 06.08.2012
you could do it like this, i do it like this, don't know if it's faster tho:
pawn Код:
new second, minute, hour, time[10];
gettime(hour, minute, second);
format(time, sizeof(time), "%i:%i:%i", hour, minute, second);
//save this variable (time)
//then to split it up you use sscanf
//othe function
new second, minute, hour;
sscanf(/*your saved variable here*/,"p<:>ddd",hour,minute,second);
//then you can use the different variables again but you only need to save one variable (but it's a string)
Hope i helped