you checked the distance from the same player you did GetPlayerPos.
pawn Код:
stock SendMessageForNearbyPlayer(playerid, text[])
{
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid, posX, posY, posZ);
for (new p = 0; p<MAX_PLAYERS; p++)
{
if (IsPlayerConnected(p))
{
if(IsPlayerInRangeOfPoint(p, 2.0, posX, posY, posZ))
{
SendClientMessage(p, 0x3C3C3CFF, text);
return 1;
}
else if(IsPlayerInRangeOfPoint(p, 4.0, posX, posY, posZ))
{
SendClientMessage(p, 0x6F6F6FFF, text);
return 1;
}
else if(IsPlayerInRangeOfPoint(p, 6.0, posX, posY, posZ))
{
SendClientMessage(p, 0xFFFFFF, text);
return 1;
}
}
}
return 1;
}
edited: added returns.