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 drowningCollisionProof 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:
| Hash | Weapon |
|---|---|
WEAPON_PISTOL | Pistol |
WEAPON_COMBATPISTOL | Combat Pistol |
WEAPON_SMG | SMG |
WEAPON_ASSAULTRIFLE | Assault Rifle |
WEAPON_SNIPERRIFLE | Sniper Rifle |
WEAPON_PUMPSHOTGUN | Pump Shotgun |
WEAPON_RPG | RPG |
WEAPON_KNIFE | Knife |
WEAPON_BAT | Baseball 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:
- Create a new file (e.g.,
locales/es.json) - Translate all strings
- 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 structureui/style.css- Stylingui/script.js- JavaScript logic
Integration Tips
Creating Zones for Custom MLOs
When adding zones for custom interiors:
- Enable
debug = trueon your zone - Use PolyZone creator tools to get coordinates
- Adjust
minZandmaxZto cover all floors - Test with different weapon types
- Set
debug = falsefor 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)