06.02.2009, 17:15
I tried it in several ways, but I don't know how to get it to work
Please help me !
Please help me !
new PlayTime[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("TimeUpdate",1000, 1);
}
public OnPlayerConnect(playerid)
{
PlayTime[playerid] = 0;
// load previous time stats somehow, not my problem :)
}
public OnPlayerDisconnect(playerid, reason)
{
// save previous time stats somehow, also not my problem :)
}
public TimeUpdate()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
PlayTime[i]++;
if (PlayTime[i] > 3600)
SetPlayerScore(i, ((PlayTime[i] / 60) / 60));
else
SetPlayerScore(i, 0);
}
}
}