I'd suggest using the new function, IsPlayerInRangeOfPoint in the ProxDetector:
pawn Код:
stock ProxDetector(Float:radi, playerid, string[], col1, col2, col3, col4, col5)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
foreach (Player,i) // This loops through all players
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid) && GetPlayerInterior(i) == GetPlayerInterior(playerid)) // This checks if the virtual world and interior are the same with the playerid
{
if(IsPlayerInRangeOfPoint(i, radi/16,oldposx, oldposy, oldposz)) SendClientMessage(i, col1, string);
else if(IsPlayerInRangeOfPoint(i, radi/8,oldposx, oldposy, oldposz)) SendClientMessage(i, col2, string);
else if(IsPlayerInRangeOfPoint(i, radi/4,oldposx, oldposy, oldposz)) SendClientMessage(i, col3, string);
else if(IsPlayerInRangeOfPoint(i, radi/2,oldposx, oldposy, oldposz)) SendClientMessage(i, col4, string);
else if(IsPlayerInRangeOfPoint(i, radi,oldposx, oldposy, oldposz)) SendClientMessage(i, col5, string);
}
}
return 1;
}
And to send the local message, use OnPlayerText:
pawn Код:
public OnPlayerText(playerid, text[])
{
new String[128];
format(String, sizeof String, "%s says: %s", pName(playerid), text);
ProxDetector(7.0, playerid, String, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
return 0;
}
Something like this. Now, when a player texts anything, only the players in range of 7.0 to the player can 'see' it.
COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, etc are the colors used, as the target keeps getting away from the player.
So, if other players are next to the one that texts, they'll see the text in WHITE and as they go far away, the color'll slowly "turn" into grey, like they would 'hear' it a bit lower.
Of course, you can use the same color five times. For instance, in the /me command. You'll use the me color in every 5 'color' parameters. Something like:
pawn Код:
ProxDetector(7.0, playerid, String, 0xF9B7FFAA, 0xF9B7FFAA, 0xF9B7FFAA, 0xF9B7FFAA, 0xF9B7FFAA);
Where '0xF9B7FFAA' = the color of /me