27.05.2014, 13:37
I know that you have to use a player time variable and a time function for this to work, but what would be the code for this? I'm new at this, sorry.
new TimeJoined[MAX_PLAYERS]; //This is used to store the time that each player joined.
public OnPlayerConnect(playerid) //Called when a player connects
{
TimeJoined[playerid] = gettime(); //Will store a unix timestamp as the time that the player joined.
return 1;
}
CMD:timeplayed(playerid, params[])
{
new fstr[50];
format(fstr, sizeof(fstr), "You have been playing for %d seconds.", gettime() - TimeJoined[playerid]);
SendClientMessage(playerid, -1, fstr);
return 1;
}