Just a question
#1

Is there any tutorials that explains how to count the current player's online time and save it with y_ini?
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)