SendClientMessageToAll to only surrounding people
#1

How would I be able to make it that only people next to you could see what you've said. Like in a RP server how it's not broad casted to the whole server. Would I basically have to just use SendClientMessage instead?
Reply
#2

loop through all players, and if they're in a certain radius, send the message.

Probably best to use a loop and the native function of IsPlayerInRangeOfPoint (https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint)
Reply
#3

You will need to do some editing:

pawn Код:
forward NearByMessage(playerid, color, string[]);
public NearByMessage(playerid, color, string[])
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    foreach(Player, i)
    {
        GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
        if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ))
        {
            if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i) && GetPlayerInterior(playerid) == GetPlayerInterior(i))
            {
                SendClientMessage(i, color, string);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)