Need to make timer work for all ID's not just for ID 0 HELP !
#1

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 !
Reply
#2

pawn Код:
SetTimer("SecondTimer",4000, 1);


forward SecondTimer();
public SecondTimer()
{
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        SendClientMessage(i,COLOR," ");
    }
}
Reply
#3

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, " ");
}
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)