Jump to content

About This File

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.

What's New in Version 1.1.0   See changelog

Released

Added more RAGEMP-like syntax, now you can use:

mp.world.zone.getName2d(coords); // == mp.world.getNameOfZone2D
mp.world.zone.getName3d(coords); // == mp.world.getNameOfZone3D
mp.world.zone.getType(coords); // == mp.world.getTypeOfZone

 

  • Like 4

User Feedback

Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...