SA-MP Forums Archive
[A small question, please help] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [A small question, please help] (/showthread.php?tid=100384)



[A small question, please help] - dirkblok - 04.10.2009

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


Re: [A small question, please help] - MadeMan - 04.10.2009

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.


Re: [A small question, please help] - dice7 - 04.10.2009

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