Played time problem - gettime();
#1

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();
}
2. Store the time when i need to

Code:
public OnPlayerDisconnect(playerid, reason)
{
PlayerInfo[playerid][pPlayedTime] += (gettime() - TimeJoined[playerid]);
}
Everything works fine untill the player goes ALT+TAB for more then 3 minutes.

- 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 ... ?
Reply


Messages In This Thread
Played time problem - gettime(); - by LowIQ - 24.06.2020, 00:50
Re: Played time problem - gettime(); - by LetsDoItPerfect - 24.06.2020, 03:01
Re: Played time problem - gettime(); - by Sultanz - 24.06.2020, 06:01
Re: Played time problem - gettime(); - by LowIQ - 24.06.2020, 13:19
Re: Played time problem - gettime(); - by Filbert - 24.06.2020, 13:41
Re: Played time problem - gettime(); - by LowIQ - 24.06.2020, 13:56
Re: Played time problem - gettime(); - by LetsDoItPerfect - 26.06.2020, 04:41

Forum Jump:


Users browsing this thread: 1 Guest(s)