SendClientMessageToAll to only surrounding people - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendClientMessageToAll to only surrounding people (
/showthread.php?tid=198351)
SendClientMessageToAll to only surrounding people -
jm2rock - 11.12.2010
How would I be able to make it that only people next to you could see what you've said. Like in a RP server how it's not broad casted to the whole server. Would I basically have to just use SendClientMessage instead?
Re: SendClientMessageToAll to only surrounding people -
Redirect Left - 11.12.2010
loop through all players, and if they're in a certain radius, send the message.
Probably best to use a loop and the native function of IsPlayerInRangeOfPoint (
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint)
Re: SendClientMessageToAll to only surrounding people -
Scenario - 11.12.2010
You will need to do some editing:
pawn Код:
forward NearByMessage(playerid, color, string[]);
public NearByMessage(playerid, color, string[])
{
new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
foreach(Player, i)
{
GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ))
{
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i) && GetPlayerInterior(playerid) == GetPlayerInterior(i))
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}