Need to make timer work for all ID's not just for ID 0 HELP ! - 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: Need to make timer work for all ID's not just for ID 0 HELP ! (
/showthread.php?tid=85754)
Need to make timer work for all ID's not just for ID 0 HELP ! -
mdaniel - 09.07.2009
Hi...
So lets say I have a verry simple script.
Код:
SetTimer("SecondTimer",4000, 1);
Код:
forward SecondTimer(playerid);
public SecondTimer(playerid)
{
SendClientMessage(playerid,COLOR," ");
}
Just in every 4 seconds it writes another blank text line... As simple as that.
The basic problem is, that The timer works just on ID 0. I really need it to work on all the ID's !!!!!!!!
Im just a begginer in scripting, so please try to answer simple... That a begginer programmer would understand
REALY NEED THIS !
Re: Need to make timer work for all ID's not just for ID 0 HELP ! -
Marcel - 09.07.2009
pawn Код:
SetTimer("SecondTimer",4000, 1);
forward SecondTimer();
public SecondTimer()
{
for( new i = 0; i < MAX_PLAYERS; i++ )
{
SendClientMessage(i,COLOR," ");
}
}
Re: Need to make timer work for all ID's not just for ID 0 HELP ! -
SpiderPork - 09.07.2009
Or if you wish to set it only for one player, you can use this:
pawn Код:
SetTimerEx("SecondTimer", 4000, 1, "i", playerid);
forward SecondTimer(playerid);
public SecondTimer(playerid)
{
SendClientMessage(playerid, COLOR, " ");
}
Re: Need to make timer work for all ID's not just for ID 0 HELP ! -
Lazarus - 09.07.2009
Actually mdaniel, you can use what you have, and it would be more efficient then Marcel's code.
Simple change your
pawn Код:
SendClientMessage(playerid, COLOR, " ");
to
pawn Код:
SendClientMessageToAll(COLOR, " ");
+ you might as well remove the playerid's.