[A small question, please help]
#1

Hello,

I couldn't find on the wiki or forums how to change this:

I want to set that only players nearby the one who says something can hear it and when the distance increases you can't hear it anymore so not everyone in the server hears what you say.

Does someone know what I mean? please help me

Thanks

Dirk
Reply
#2

pawn Код:
ProxDetector(Float:radi, playerid, string[], color)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, color, string);
                }
            }
        }
    }
    return 1;
}
EXAMPLE:

ProxDetector(5.0, playerid, "Hello everybody", COLOR_GREEN); will send "Hello everybody" to everyone in 5.0 radius near player.
Reply
#3

https://sampwiki.blast.hk/wiki/LimitGlobalChatRadius
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)