SA-MP Forums Archive
instead of playerid, allplayers? - 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)
+--- Thread: instead of playerid, allplayers? (/showthread.php?tid=431462)



instead of playerid, allplayers? - NicholasA - 18.04.2013

So you have SendClientMessage(playerid, -1, "Hello");
Cant I do something like SendClientMessage(allplayers, -1, "Hello");
I know i could SendClientMessageToAll(-1, "Hello");
But I just need to know if i could do it that way


Re: instead of playerid, allplayers? - LarzI - 18.04.2013

Loops.


Re: instead of playerid, allplayers? - NicholasA - 18.04.2013

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Loops.
Example?


Re: instead of playerid, allplayers? - RajatPawar - 18.04.2013

pawn Код:
for( new i; i < MAX_PLAYERS; i++ )
{
    // Checking if he's connected, etc.
   SendClientMessage(i, -1, "Message");
}
But anyways, it's obviously slower than SendClientMessageToAll.


Re: instead of playerid, allplayers? - NicholasA - 18.04.2013

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
pawn Код:
for( new i; i < MAX_PLAYERS; i++ )
{
    // Checking if he's connected, etc.
   SendClientMessage(i, -1, "Message");
}
But anyways, it's obviously slower than SendClientMessageToAll.
I know but i want to use it to set skins and stuff, thanks !


Re: instead of playerid, allplayers? - MP2 - 18.04.2013

Has everyone forgotten about SendClientMessageToAll?


Re: instead of playerid, allplayers? - HurtLocker - 18.04.2013

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
pawn Код:
for( new i; i < MAX_PLAYERS; i++ )
{
    // Checking if he's connected, etc.
   SendClientMessage(i, -1, "Message");
}
But anyways, it's obviously slower than SendClientMessageToAll.
Quote:
Originally Posted by MP2
Посмотреть сообщение
Has everyone forgotten about SendClientMessageToAll?
No, we haven't!


Re: instead of playerid, allplayers? - icko202 - 18.04.2013

https://sampwiki.blast.hk/wiki/Function:...ntMessageToAll


Re: instead of playerid, allplayers? - XStormiest - 18.04.2013

SendClientMessageToAll is used to send to all players where = 'playerid' parameter does not exist,
but when you make loops, you can make a specified condition , for example if players are vips
I recomand foreach,
Код:
    foreach(Player,i)
    {
             if(PlayerInfo[i][Vip] < 1)
             {
                  SendClientMessage(playerid,COLOR_BLUE,"Hey vips!");
             }
    }
but you can also do that with the normal loop
Код:
   for(new i = 0; i < MAX_PLAYERS;i++)
   {
        //comment here
   }
Anyway good luck


Re: instead of playerid, allplayers? - MP2 - 18.04.2013

Why would you use '< 1' there? Surely it's either 0 or 1 - it's never going to be negative. I'm fairly certain < and > are slower than == or !=.