Total Hours On Server = Player Score
#1

I tried it in several ways, but I don't know how to get it to work

Please help me !
Reply
#2

Hmhm, You can do it like the paydays system on GF.
Every our the player gets a payday. It saves onto /stats command with his currently paydays ammount.
Reply
#3

okay, but how to do that?
Reply
#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
#5

thanks I will try it
Reply
#6

just updated it, re-copy
Reply
#7

ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)