Just a question
#2

Use the gettime() function, it returns the Unix timestamp, more about the function here.

When someone joins, store the value of the Unix timestamp of that moment somewhere, then when they leave, subtract the Unix timestamp stored from the timestamp then, you will have the seconds spent online by that specific player.

PHP код:
new pTimeStamp[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
pTimeStamp[playerid] = gettime();
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
timeOnline gettime() - pTimeStamp[playerid];
    return 
1;
}
// the timeOnline variable has the time spent online by that player in seconds. 
Reply


Messages In This Thread
Just a question - by wallen - 29.01.2018, 11:05
Re: Just a question - by Eoussama - 29.01.2018, 11:10

Forum Jump:


Users browsing this thread: 1 Guest(s)