Unix timestamp 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: Unix timestamp help.. (
/showthread.php?tid=355829)
Unix timestamp help.. -
Euan Hughes - 01.07.2012
So i am trying to create a VIP system for like 30 days.. the only problem is im not sure how to do it am i right in thinking it would be something like this
pawn Код:
command(viplevel, playerid, params[])
{
new time;
time = gettime() - 10
// code here
}
I really am confused i have tried reading the tutorial i just dont understand how it works and how it checks it if the player has run out of VIP
If you need any more code just ask
Thanks
Re: Unix timestamp help.. -
Vince - 01.07.2012
You go to ****** and type '30 days in seconds'. It will tell you that 30 days is 2592000 seconds, or 60 seconds in a minute * 60 minutes in an hour * 24 hours in a day * 30 days. When you set the level, you add that amount to the current timestamp and save it as the expire time;
pawn Код:
expire = gettime() + 60*60*24*30;
When a player connects (or whenever you want it to expire), you check if the current timestamp is greater than the one that was saved, meaning that the level has expired.
Re: Unix timestamp help.. -
Euan Hughes - 01.07.2012
Quote:
Originally Posted by Vince
You go to ****** and type '30 days in seconds'. It will tell you that 30 days is 2592000 seconds, or 60 seconds in a minute * 60 minutes in an hour * 24 hours in a day * 30 days. When you set the level, you add that amount to the current timestamp and save it as the expire time;
pawn Код:
expire = gettime() + 60*60*24*30;
When a player connects (or whenever you want it to expire), you check if the current timestamp is greater than the one that was saved, meaning that the level has expired.
|
Thanks
One more questions how would i make it so it shows how long you have left when you do /stats
pawn Код:
command(stats, playerid, params[])
{
VIP: expire;
}
Would that work
If you need any more code just ask
Thanks
Re: Unix timestamp help.. -
Euan Hughes - 01.07.2012
If you need any more code just ask
Thanks