SA-MP Forums Archive
ProxDetector - 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: ProxDetector (/showthread.php?tid=567235)



ProxDetector - Denis1 - 12.03.2015

I've been told that ProxDetector is an old and outdated function. Ah well, my question is, what should I use instead? I haven't been scripting for too long and I have to know what is the best way to check if the player is in a given range to see another player's sent message. I'm expecting replies from known, talented scripters.


Re: ProxDetector - oliverrud - 12.03.2015

I use IsPlayerInRangeOfPoint(Float:range,Float,Float:y ,Float:z)
But can't really say whether its optimal, it works fine tho.


Re: ProxDetector - Denis1 - 12.03.2015

Other answers?


AW: Re: ProxDetector - Kaliber - 12.03.2015

Quote:
Originally Posted by Denis1
Посмотреть сообщение
Other answers?
Well, yeah you should use IsPlayerInRangeOfPoint

Quote:
Originally Posted by Denis1
Посмотреть сообщение
and I have to know what is the best way to check if the player is in a given range to see another player's sent message
You can youse this function:

Код:
stock SendRangeMessage(playerid,color,Float:range,const string[]) {
    new Float:p[3],i;
    GetPlayerPos(playerid,p[0],p[1],p[2]);
    for(;i<MAX_PLAYERS; i++) if(IsPlayerInRangeOfPoint(i,range,p[0],p[1],p[2])) SendClientMessage(i,color,string);
    return 1;
}

//Example:
SendRangeMessage(playerid,-1,15.0,"Hallo"); //Sends a Message to all players in a range of 15.0
Greekz


Re: ProxDetector - Denis1 - 12.03.2015

Thanks for your answer, Kaliber. I have just given you a reputation point.


Re: ProxDetector - CalvinC - 12.03.2015

Plainly using IsPlayerInRangeOfPoint will send messages through virtualworlds, making businesses and houses pretty glitchy if they use the same interior though.
I don't see anything wrong in using ProxDetector, it works just fine.