SA-MP Forums Archive
Question about Timestamp. - 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: Question about Timestamp. (/showthread.php?tid=502931)



Question about Timestamp. - Dokins - 26.03.2014

How do I get another players timezone? Take for instance, I banned a player for two hours, Server is hosted in UK, and they are somewhere with GMT + 1 That means they'll be unbanned in an hour instead of two....How do I get the timestamp of an actual player?


Re: Question about Timestamp. - Vince - 26.03.2014

No, they won't. gettime() always return the server time.


Re: Question about Timestamp. - Dokins - 26.03.2014

Ohhh yeahhhhh.... Makes sense. Thank you.


Re: Question about Timestamp. - DeStunter - 26.03.2014

Quote:
Originally Posted by Dokins
Посмотреть сообщение
Ohhh yeahhhhh.... Makes sense. Thank you.
You could always base there location off of geo-ip and use the timezone of the region of that area and adjust gettime() accordingly for that ban.


Re: Question about Timestamp. - Dokins - 26.03.2014

That wouldn't work, I'm afraid. I forgot that gettime only uses the server time, so therefore it's comparing itself and not the players time. Thanks anyway, and thanks to Vince.


Re: Question about Timestamp. - DeStunter - 26.03.2014

Quote:
Originally Posted by Dokins
Посмотреть сообщение
That wouldn't work, I'm afraid. I forgot that gettime only uses the server time, so therefore it's comparing itself and not the players time. Thanks anyway, and thanks to Vince.
how would it not work? if you use geo-ip to know a user is in say GMT+1 and the server is in GMT+2 why can't you adjust the gettime() result by one hour? its just math some simple math.


Re: Question about Timestamp. - Dokins - 26.03.2014

It's based off the server time, not the player time, so when a player is banned and logs back in, the timestamp will be the same one in the server, not on the player so if I adjust that per player then it's going to adjust the actual server timestamp.


Re: Question about Timestamp. - DeStunter - 26.03.2014

oh, oh, oh, oh, I see what you meant by the question now. You were wondering if gettime() would return the players time or not. My bad, ignore me.


Re: Question about Timestamp. - Dokins - 26.03.2014

It was actually my own fault for being dumb and having a bad memory aha!

Gettime always returns the servertime, so no matter where in the world you are, you won't be unbanned until the server time > timestamp.