SA-MP Forums Archive
How to set SetTimerEx to all players ? - 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: How to set SetTimerEx to all players ? (/showthread.php?tid=119465)



How to set SetTimerEx to all players ? - wiilweer - 08.01.2010

I got this

SetTimerEx("vabReklaam1", 10000, false, "i", playerid);

But it works only for player himself, how to set timer to make such effect that when timer is started then all players are getting it's influence


Re: How to set SetTimerEx to all players ? - lameguy - 08.01.2010

Add this to beginning of your vabReklaam1 timer:

for(new i=0; i < MAX_PLAYERS; i++)
{

And then when there is for instance SetPlayerHealth(playerid, 100);
change it to SetPlayerHealth(i, 100);

And that for every actoin in vabReklaam1.

I'm not sure if thats the best way, but it works.


Re: How to set SetTimerEx to all players ? - shady91 - 08.01.2010

do you mean you want just one timer for everyone or you want a timer to start for everyplayer?


Re: How to set SetTimerEx to all players ? - wiilweer - 08.01.2010

To everybody, it denies to use command for 10 seconds


Re: How to set SetTimerEx to all players ? - Correlli - 08.01.2010

Quote:
Originally Posted by Johnson_boy
Add this to beginning of your vabReklaam1 timer:

for(new i=0; i < MAX_PLAYERS; i++)
{

And then when there is for instance SetPlayerHealth(playerid, 100);
change it to SetPlayerHealth(i, 100);

And that for every actoin in vabReklaam1.

I'm not sure if thats the best way, but it works.
Using:
pawn Код:
for(new u = 0; u < MAX_PLAYERS; u++) SetTimerEx("vabReklaam1", 10000, false, "i", u);
would cause lag.

Use one timer (SetTimer-function) and make a loop for all players inside it.