Version 1.1.0
94 downloads
This resource adds 3 functions to the serverside mp.world object that provides zone name and type information.
Serverside API
/**
* Returns the name of the area/zone at specified coords, ignores heights.
* @param {object} coords An object with "x" and "y" properties.
* @return {string} Zone name.
*/
mp.world.getNameOfZone2D(coords);
/**
* Returns the name of the area/zone at specified coords.
* @param {object} coords An object with "x", "y" and "z" properties, such as mp.Vector3.
* @return {string} Zone name.
*/
mp.world.getNameOfZone3D(coords);
/**
* Returns the type of the area/zone at specified coords.
* @param {object} coords An object with "x" and "y" properties.
* @return {string} Zone type, either "city" or "countryside".
*/
mp.world.getTypeOfZone(coords);
Example
const coords = new mp.Vector3(1823.961, 4708.14, 42.4991); // Grapeseed Bunker
console.log(`Name 2D: ${mp.world.getNameOfZone2D(coords)}`); // Expected output: Grapeseed
console.log(`Name 3D: ${mp.world.getNameOfZone3D(coords)}`); // Expected output: Grapeseed
console.log(`Zone Type: ${mp.world.getTypeOfZone(coords)}`); // Expected output: countryside
Notes
Available on GitHub: https://github.com/root-cause/ragemp-zone-api
N.O.O.S.E area returns Tataviam Mountains instead.
There might be other areas with inaccuracies, feel free to share a fix in comments/send a pull request.