10.09.2011, 17:14
Here is mine that I use in my custom gamemode. Change the PlayerInfo[playerid][Logged] to what ever you use to check if the player is connected. Other then that here it is.
EDIT: Mine detects if the player is in the same world and if they are logged also.
pawn Код:
stock SendRangedMessage(sourceid, color, message[], Float:range)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(sourceid, x, y, z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Logged] == 1)
{
if(GetPlayerVirtualWorld(sourceid) == GetPlayerVirtualWorld(i))
{
if(IsPlayerInRangeOfPoint(i, range, x, y, z))
{
SendClientMessage(i, color, message);
}
}
}
}
return 1;
}