Is player near a player & more. - 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)
+--- Thread: Is player near a player & more. (
/showthread.php?tid=639483)
Is player near a player & more. -
AmarPlayer - 18.08.2017
Hello, I want to know how to check is player near a player for some commands like give, pay and similar.
Also how can I make that only the players that are near a player can see his messages, I've been trying to find that everywhere but I can't.
I tried this:
Код:
new id;
GetPlayerPos(id, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, id, 3.0))
{
//EXAMPLE
}
but it doesn't work.
If anybody has a filterscript or something, I would be very thankful.
Thank you for any kind of help.
Re: Is player near a player & more. -
FuNkYTheGreat - 18.08.2017
PHP код:
CMD:message(playerid,params[])
{
new text[32];
if(sscanf(params,"s[32]",text)) return SendClientMessage(playerid,-1,"/message [message]");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
new pName[24];
GetPlayerName(playerid,pName,sizeof(pName));
new string[250];
format(string,sizeof(string),"[MESSAGE] %s[%d]: %s",pName,playerid,text);
for(new i=0;i<=MAX_PLAYERS;i++) // Looping through MAX PLAYERS
{
if(IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(i,-1,string); // sending the message to the nearest player , between 15 metres.
}
return 1;
}
An example, which sends the message to the nearest player,
Re: Is player near a player & more. -
AmarPlayer - 18.08.2017
Ok, thank you. I'll try to adjust that to OnPlayerText.