theralio 0 Posted August 14, 2018 Hello, I search a Function like this http://wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint i still dont find anything. Greets, Sebastian Share this post Link to post Share on other sites
izcream* 0 Posted August 14, 2018 mp.players.forEachInRange(player.position, int: range, (player) => { //do }) Ref: Wiki Share this post Link to post Share on other sites
Protocole 13 Posted August 14, 2018 Else, you can try vectorial maths: https://math.stackexchange.com/questions/42640/calculate-distance-in-3d-space Share this post Link to post Share on other sites
paccoderpster 1 Posted August 17, 2018 /** * @author Paccoderpster * @param {mp.Vector3} pos1 * @param {mp.Vector3} pos2 * @param {number} range * @return true if the player is range; false if not */ global.isInRange = function isInRange(pos1, pos2, range) { return ( Math.sqrt( Math.pow(pos1.x - pos2.x, 2) + Math.pow(pos1.y - pos2.y, 2) + Math.pow(pos1.z - pos2.z, 2) ) <= range ); } Share this post Link to post Share on other sites
Doom 5 Posted August 19, 2018 (edited) You may also find this function useful as well: https://wiki.rage.mp/index.php?title=Entity::dist Clientside: https://wiki.rage.mp/index.php?title=System::vdist https://wiki.rage.mp/index.php?title=System::vdist2 Edited August 19, 2018 by Doom Share this post Link to post Share on other sites