15.05.2014, 16:16
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 .
I need it for an /arrest command .
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)
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!
}