Player clock switch
#1

So I found the function to toggle the player clock on or off:
Код:
public OnPlayerConnect(playerid)
{
    TogglePlayerClock(playerid, 1); // Show the clock
    return 1;
}
Is there a way make this affect all players by one command?
To type /playerclockon and the clock would be enabled for all.
/playerclockoff and it would be disabled.
Reply
#2

Loop through the players and toggle it on/off.

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
		{
		    if(IsPlayerConnected(i))
		    {
		    	TogglePlayerClock(i, 0); //or 1
		    }
		}
Reply
#3

Yes i agree with TheOnlyRealFuzzy Loop it through all players try this command.

you must have #include <zcmd> or you can convert it to what every command proccesor you are using

try this

pawn Код:
//Turn the Clock on for all connected players
CMD:playerclockon(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            TogglePlayerClock(i, 1);
        }
    }
    return 1;
}

//Turn the Clock off for all connected players
CMD:playerclockon(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            TogglePlayerClock(i, 0);
        }
    }
    return 1;
}
Reply
#4

thx, guys, I'lll try it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)