SA-MP Forums Archive
Timer - 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: Timer (/showthread.php?tid=74056)



Timer - JoeDaDude - 19.04.2009

Hello,
I want a players score to go up 1 point every 30 seconds then in a certain car (car1)
I have part of the code but not the timer bit.
This is the code i have so far:
pawn Код:
if(IsPlayerInVehicle(playerid, car1))
SetPlayerScore(playeridid, GetPlayerScore(playerid) + 1);
Can anyone help me please


Re: Timer - Rks25 - 19.04.2009

make a function with a timer, than loop it.


Re: Timer - JoeDaDude - 19.04.2009

Quote:
Originally Posted by Rk_
make a function with a timer, than loop it.
Sorry im a beginner to scripting


Re: Timer - Rks25 - 19.04.2009

here you go:
pawn Код:
SetTimer("ScoreGiver",30000,1);

forward ScoreGiver();
public ScoreGiver()
{
  for(new i=0; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerInVehicle(i, car1))
    {
      SetPlayerScore(i, GetPlayerScore(i) + 1);
    }
  }
}



Re: Timer - JoeDaDude - 22.04.2009

I get alot of errors




Re: Timer - Flo_White - 22.04.2009

posting them would be usefull!


Re: Timer - OmeRinG - 22.04.2009

Try putting the SetTimer in OnGameModeInIt