16.11.2013, 14:04
I have a stock function for you, which sends message to range players of specific position.
You can use as example below OnPlayerText.
pawn Код:
SendMessageToRangePlayer(color, message[], x, y, z, range = 30.0)
pawn Код:
stock SendMessageToRangePlayer(color, message[], x, y, z, range = 30.0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, range, x, y, z))
{
SendClientMessage(i, color, message);
}
}
return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s: %s", pName[playerid], text);
SendMessageToRangePlayer(-1, string, x, y, z);
return 1;
}