Total Hours On Server = Player Score
#4

example:

pawn Код:
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);
    }
  }
}
It's best to change MAX_PLAYERS to your own variable, I won't explain why, because many other people have done so before, and you can get at it by searching.
Reply


Messages In This Thread
Total Hours On Server = Player Score - by stieben - 06.02.2009, 17:15
Re: Total Hours On Server = Player Score - by MenaceX^ - 06.02.2009, 17:23
Re: Total Hours On Server = Player Score - by stieben - 06.02.2009, 17:24
Re: Total Hours On Server = Player Score - by 1337pr0 - 06.02.2009, 17:30
Re: Total Hours On Server = Player Score - by stieben - 06.02.2009, 17:34
Re: Total Hours On Server = Player Score - by 1337pr0 - 06.02.2009, 17:35
Re: Total Hours On Server = Player Score - by stieben - 06.02.2009, 18:07

Forum Jump:


Users browsing this thread: 1 Guest(s)