SA-MP Forums Archive
[SOLVED] How to make some sort of radius? - 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: [SOLVED] How to make some sort of radius? (/showthread.php?tid=125573)



[SOLVED] How to make some sort of radius? - mrbubl3s - 04.02.2010

As the title says, I need to make some sort of radius for chats, like when I /me farts, the whole world knows!


Re: How to make some sort of radius? - Rubennnnn - 04.02.2010

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


Re: How to make some sort of radius? - Correlli - 04.02.2010

You could use IsPlayerInRangeOfPoint function with loop for all players and check if they're in that range.


Re: How to make some sort of radius? - mrbubl3s - 04.02.2010

Hot damn, well thanks guys!


Re: How to make some sort of radius? - mansonh - 04.02.2010

Quote:
Originally Posted by Rubennnnn
You didn't read the question XD

Pretty simple

in your /me command

pawn Код:
strcmp......
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
for(new p=0; p<GetMaxPlayers(); p++)
{
   //replace 10 with the radius you want
   If(IsPlayerConnected(p) && IsPlayerInRangeOfPoint(p, 10, X, Y, Z)) SendClientMessage(p, 0xAAAAAAAA, "your message here");
}

.....





Re: How to make some sort of radius? - mrbubl3s - 04.02.2010

I can't get it to work D: heres what i have for /me.

Код:
 if(!strcmp(cmdtext, "/me", true, 4))
  {
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [ACTION]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    SendClientMessageToAll(0xFFFF00AA, str);
    return 1;
  }



Re: How to make some sort of radius? - MadeMan - 04.02.2010

pawn Код:
if(!strcmp(cmdtext, "/me", true, 4))
{
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [ACTION]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 40.0, x, y, z))
            {
                SendClientMessage(i, 0xFFFF00AA, str);
            }
        }
    }
    return 1;
}
Radius is set to 40.0 but you can change that.


Re: How to make some sort of radius? - mrbubl3s - 04.02.2010

Marvelous.


Re: [SOLVED] How to make some sort of radius? - t33DeeJay - 04.02.2010

Was Having This Issue My Self But I Read The Fix Thanks For Helping,