SA-MP Forums Archive
Send a message to everyone near except for the person self - 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: Send a message to everyone near except for the person self (/showthread.php?tid=608531)



Send a message to everyone near except for the person self - justjamie - 02.06.2016

Hello.
Title.
I currently have this, but it sends to myself.
PHP код:
    format(iStrsizeof(iStr), "(RADIO) %s: %s"MaskedName(playerid), iText);
    
ProxDetectorEx(20.0playeridiStr);
    return 
1
I wanna send it to everyone, except for the person that does the command.
How do i do that?


Re: Send a message to everyone near except for the person self - Konstantinos - 02.06.2016

Have a loop through the players and if the iterator variable is equal to the playerid, skip it.
pawn Код:
for (new i = 0, j = GetPlayerPoolSize(); i <= j; i++) // foreach(new i : Player)
{
    if (i == playerid) continue;

    SendClientMessage(i, ...);
}



Re: Send a message to everyone near except for the person self - Luicy. - 02.06.2016

PHP код:
for(new 0MAX_PLAYERSi++)
{
     New 
Float:XFloat:YFloat:Z;
     
GetPlayerPos(playeridXYZ);
     If(
IsPlayerConnected(i) && IsPlayerInRangeOf(iXYZ) && != playerid)
           
// send msg

Sorry IF any misstypes, wrote in My phone.