Timer Help - 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: Timer Help (
/showthread.php?tid=482733)
Timer Help -
KingyKings - 22.12.2013
Hey, i was just wondering if anyone could help.
I have a VIP system and a gift system.
I am trying to make it so players can win VIP for 24 hours however i don't want to have to be there to remove there vip.
I am guessing i cannot use SetTimerEx as the timer will not continue for the player if they relog i don't think?
Im not sure if im correct.
If they relog it will reset the timer or mess it up ?
Anyway if that doesn't work can someone tell me another way that this can be done? Or will it have to be done with MySQL?
Cheers.
Re: Timer Help -
Flaken - 22.12.2013
you need foreach.ini include
download it first, then put it in pawno < include
Re: Timer Help -
CutX - 22.12.2013
okey, this method works until January 19, 2038
store the timestamp of the actual time a player wins the VIP thingy in your player files
tempVIP[playerid] = gettime();
now to check if 1 day has passed, we just do this:
if(tempVIP[playerid])
{
if(gettime() - tempVIP[playerid] > 60*60*24) return //vip time is up remove the vip state
}
we can place that if statement somewhere where it gets called like every 3 or 5 seconds. We dont need a dirty timer

for example, place it in OnPlayerStatechange
time will still "pass by" even if the server is offline since were doing the timestamp-method