Help needed .

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 .

pawn Код:
    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)

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.

thank you , both

Forum Jump:

Users browsing this thread: 1 Guest(s)