24.06.2020, 06:01
Quote:
Hello!
I have a problem with players played time checking! 1. Check when player joined the game and save it to variable: Code:
new TimeJoined[MAX_PLAYERS]; public OnPlayerConnect(playerid) //... or when player login to the account { TimeJoined[playerid] = gettime(); } Code:
public OnPlayerDisconnect(playerid, reason) { PlayerInfo[playerid][pPlayedTime] += (gettime() - TimeJoined[playerid]); } - Option one: Someone joined the server, was not ALT+TAB and after 300 seconds leave the server. PlayerInfo[playerid][pPlayedTime] is saved as 300 and THAT IS CORRECT! - Option two: Someone joined the server, used ALT+TAB to be afk for 10 minutes, came back and... PlayerInfo[playerid][pPlayedTime] is saved as 1593137909 and THATS INCORRECT! What can i do ... ? |