22.03.2014, 13:14
It would be a lot easier adding only hours. Set a timer to run once every hour and do
The function gettime, doesn't get the time played, it gets the current time on the server. You can use the value it returns to calculate how many hours, minutes and seconds the player has been online.
https://sampwiki.blast.hk/wiki/Gettime
It returns the current hour, minute and second. Say that the server time is 8:21 PM (8:21:09) (Hour, Minutes, Seconds), it will return the value 8 for hour, 21 for minutes and 9 seconds.
If you get the time the player logs in, and then get it again when he logs out, you can calculate the time be's been online from that. Please note that you should get the date as well, so that it doesn't mistake it for being the same day.
pawn Код:
PlayerInfo[playerid][hours]++;
https://sampwiki.blast.hk/wiki/Gettime
It returns the current hour, minute and second. Say that the server time is 8:21 PM (8:21:09) (Hour, Minutes, Seconds), it will return the value 8 for hour, 21 for minutes and 9 seconds.
If you get the time the player logs in, and then get it again when he logs out, you can calculate the time be's been online from that. Please note that you should get the date as well, so that it doesn't mistake it for being the same day.