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



Help needed . - Johnson_Brooks - 15.05.2014

How to check if a player is near to another player (close to him up to 10meters) on foot ?
I need it for an /arrest command .


Re: Help needed . - Konstantinos - 15.05.2014

pawn Код:
new
    Float: pX,
    Float: pY,
    Float: pZ;

GetPlayerPos(id, pX, pY, pZ); // edit "id" to the variable you store the player's ID who is about to be arrested
if (!IsPlayerInRangeOfPoint(playerid, 10.0, pX, pY, pZ)) return // error message (not close enough)



Re: Help needed . - Campbell- - 15.05.2014

pawn Код:
new pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
if(IsPlayerInRangeOfPoint(idOfUserToGetArrested, 10.0, pos[0], pos[1], pos[2])) {
    // In range!
} else {
    // Not in range!
}
Edit: As mentioned above.


Re: Help needed . - Johnson_Brooks - 15.05.2014

thank you , both