SA-MP Forums Archive
Score.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Score.. (/showthread.php?tid=139768)



Score.. - TheNotorius - 06.04.2010

Hello, I've Tried Making
A System Which Allows To Give You +1 Score Every... 10 Minutes or So
And It's Miserably Failed.

Any Possible Idea's?

Thank's In Advance.

~J.Sanders


Re: Score.. - Hiddos - 06.04.2010

pawn Код:
new ScoreTimer;
forward ScoreUpdate();

public OnGameModeInit()
{
  ScoreTimer = SetTimer("ScoreUpdate",600000,1);
  return 1;
}

public OnGameModeExit()
{
   KillTimer(ScoreTimer);
   return 1;
}

public ScoreUpdate()
{
   for(new i; i < MAX_PLAYERS; i++)
   {
     if(IsPlayerConnected(i))
     {
        SetPlayerScore(i,GetPlayerScore(i)+1);
     }
   }
   return 1;
}



Re: Score.. - [MWR]Blood - 06.04.2010

Thanks, I needed this too!


Re: Score.. - TheNotorius - 06.04.2010

Quote:
Originally Posted by Hiddos
pawn Код:
new ScoreTimer;
forward ScoreUpdate();

public OnGameModeInit()
{
  ScoreTimer = SetTimer("ScoreUpdate",600000,1);
  return 1;
}

public OnGameModeExit()
{
  KillTimer(ScoreTimer);
  return 1;
}

public ScoreUpdate()
{
  for(new i; i < MAX_PLAYERS; i++)
  {
     if(IsPlayerConnected(i))
     {
       SetPlayerScore(i,GetPlayerScore(i)+1);
     }
  }
  return 1;
}
Thank You So Much! <33.


Re: Score.. - Mikep. - 06.04.2010

Quote:
Originally Posted by Hiddos
pawn Код:
new ScoreTimer;
forward ScoreUpdate();

public OnGameModeInit()
{
  ScoreTimer = SetTimer("ScoreUpdate",600000,1);
  return 1;
}

public OnGameModeExit()
{
  KillTimer(ScoreTimer);
  return 1;
}

public ScoreUpdate()
{
  for(new i; i < MAX_PLAYERS; i++)
  {
     if(IsPlayerConnected(i))
     {
       SetPlayerScore(i,GetPlayerScore(i)+1);
     }
  }
  return 1;
}
No need to kill the timer when the gamemode unloads, it can't call the timer is the gamemode isn't loaded.