SA-MP Forums Archive
About Date and Time! - 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: About Date and Time! (/showthread.php?tid=572473)



About Date and Time! - NexTioN1230 - 28.04.2015

Hello all,
for example i took the number of the gettime(); and i got 99545432 (only example)
how can i know the date and the time of this number (99545432)? is there any code for it or something?
thanks for help <3 !


Re: About Date and Time! - ATGOggy - 28.04.2015

99545432 = 9954532 seconds.

You can use timestamps for temporary systems like temporary banning, etc..

It works like this:
1) First, use gettime() and get the timestamp
2) If the player is getting banned for a day, we need to get the seconds in a day: 60 * 60 * 24 = 86400 seconds
3) now we'll add this to the timestamp, like this:
PHP код:
new unbantime=gettime()+86400
4) Now, you can make it work like this:
PHP код:
OnPlayerConnect(playerid)
{
    if( 
unbantime gettime() ) return Kick(playerid);
    return 
1;