Exports & API

Exports & API

legends_safezones handles zone management internally through configuration. The resource focuses on providing a robust safe zone system with customizable entity protections.

Customization

Entity Proofs (client/editable.lua)

You can customize which damage protections are applied to players inside safe zones by editing client/editable.lua:

EntityProofs = {}
 
EntityProofs.BulletProof = true      -- Protects from bullet damage
EntityProofs.FireProof = true        -- Protects from fire damage
EntityProofs.ExplosionProof = true   -- Protects from explosion damage
EntityProofs.CollisionProof = true   -- Prevents collision interactions
EntityProofs.MeleeProof = true       -- Protects from melee damage
EntityProofs.SteamProof = true       -- Protects from steam damage
EntityProofs.P7 = true               -- Unknown parameter (keep true)
EntityProofs.DrownProof = true       -- Protects from drowning
⚠️

CollisionProof Note: If players experience issues entering vehicles or accessing trunks inside safe zones, set EntityProofs.CollisionProof = false. This allows normal vehicle interactions while still protecting from damage.


Zone Configuration

Zones are defined in config/config.lua. Each zone supports these options:

{
    name = "ZoneName",           -- Unique identifier
    debug = false,               -- Visualize zone boundaries
    points = { ... },            -- vector2 coordinates
    minZ = 0.0,                  -- Ground level
    maxZ = 100.0,                -- Ceiling level
    allWeapons = true,           -- Block all weapons
    weapons = {},                -- Specific weapons to block
    bypassJobs = { "police" },   -- Jobs that can use weapons
    antiVDM = true               -- Vehicle damage protection
}

Weapon Hash Reference

When blocking specific weapons, use GTA V weapon hashes:

-- Example: Block only heavy weapons
weapons = {
    `WEAPON_ASSAULTRIFLE`,
    `WEAPON_CARBINERIFLE`,
    `WEAPON_SNIPERRIFLE`,
    `WEAPON_RPG`,
    `WEAPON_GRENADELAUNCHER`,
}

Common weapon hashes:

HashWeapon
WEAPON_PISTOLPistol
WEAPON_COMBATPISTOLCombat Pistol
WEAPON_SMGSMG
WEAPON_ASSAULTRIFLEAssault Rifle
WEAPON_SNIPERRIFLESniper Rifle
WEAPON_PUMPSHOTGUNPump Shotgun
WEAPON_RPGRPG
WEAPON_KNIFEKnife
WEAPON_BATBaseball Bat

For a complete list of weapon hashes, see the FiveM Weapons Reference (opens in a new tab).


Localization

Language strings are stored in locales/en.json:

{
  "RestrictedArea": "You are not allowed to enter this area with that weapon",
  "SafeZoneTitle": "SAFE ZONE",
  "SafeZoneSubtitle": "Weapons & Violence Disabled"
}

To add a new language:

  1. Create a new file (e.g., locales/es.json)
  2. Translate all strings
  3. Set Config.Lang = "es" in config

Custom UI

The safe zone UI can be customized by editing files in the ui/ folder:

  • ui/index.html - HTML structure
  • ui/style.css - Styling
  • ui/script.js - JavaScript logic

Integration Tips

Creating Zones for Custom MLOs

When adding zones for custom interiors:

  1. Enable debug = true on your zone
  2. Use PolyZone creator tools to get coordinates
  3. Adjust minZ and maxZ to cover all floors
  4. Test with different weapon types
  5. Set debug = false for production

Job Bypass Recommendations

Common job bypass configurations:

-- Hospital: Allow medical and police
bypassJobs = { "police", "ambulance", "doctor" }
 
-- Government building: Only police
bypassJobs = { "police" }
 
-- Private security area
bypassJobs = { "police", "security" }

Need Help?

Join our Discord for support: discord.gg/lgnds (opens in a new tab)


Legends Store - Premium FiveM Scripts