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



quick question - Randomai - 24.02.2011

i'm doing zombie server and i want after zombie hit you will be infected after 10 secs, so what how to set timer to 10 sec?

this is 10 secs?

Код:
SetTimer("TurningToInfected",100,0);



Re: quick question - iMonk3y - 24.02.2011

https://sampwiki.blast.hk/wiki/SetTimer

Код:
(funcname[], interval, repeating)
 funcname[]	Name of the function to call as a string. Needs to be a public!
 interval	Interval in milliseconds.
 repeating	Boolean if the timer should occur repeatedly or only once



Re: quick question - DevilG - 24.02.2011

You would need the SetTimerEx.


Re: quick question - Luk_Ass - 24.02.2011

It is in miliseconds. So 10000.


Re: quick question - Randomai - 24.02.2011

thanks.


Re: quick question - Baboon - 24.02.2011

Under OnGameModeInit
Код:
SetTimer("healthchecker", 500, true);
Above OnGameModeInit
Код:
new ivebeenzombied[MAX_PLAYERS];
somewhere in the script (for example last lines):
Код:
forward healthchecker();
public healthchecker()
{
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
            if(IsPlayerConnected(i))
            {
                   new Float: health;
                   GetPlayerHealth(playerid, health);
                   if(ivebeenzombied[i] == 1) return 1;//to stop the code, otherwise it will repeat all the time
                   if(health < 100) //checks if the player has less health than 100.
                   {
                          code...
                          ivebeenzombied[i] = 1;
                   }
            }
      }
      return 1;
}

Hope it will help you.