Unix timestamp help..
#1

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
Reply
#2

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.
pawn Код:
if(gettime() > expire)
Reply
#3

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.
pawn Код:
if(gettime() > expire)
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
Reply
#4

If you need any more code just ask

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)