Just some "gettime" questions.
#3

here's an example of how it works:

Quote:
Originally Posted by CutX
Посмотреть сообщение
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
its indeed a nice n resource friendly replacement for any kind of timer
Reply


Messages In This Thread
Just some "gettime" questions. - by Kyance - 22.12.2013, 19:02
Re: Just some "gettime" questions. - by Vince - 22.12.2013, 19:18
Re: Just some "gettime" questions. - by CutX - 22.12.2013, 19:38
Re: Just some "gettime" questions. - by Kyance - 23.12.2013, 05:56

Forum Jump:


Users browsing this thread: 1 Guest(s)