[SOLVED] How to make some sort of radius?
#1

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

https://sampwiki.blast.hk/wiki/SendClientMessageToAll
Reply
#3

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

Hot damn, well thanks guys!
Reply
#5

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");
}

.....


Reply
#6

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;
  }
Reply
#7

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.
Reply
#8

Marvelous.
Reply
#9

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


Forum Jump:


Users browsing this thread: 2 Guest(s)