Safe Zones
This is a step-by-step installation guide, configuration preview, and full explanation of all settings for legends_safezones.
If you lack programming experience, ensure you read each step thoroughly without skipping, as all documentation is essential!
Before submitting a support ticket or following the guides in this documentation, please make sure that you are running the latest version of the resource.
What is legends_safezones?
legends_safezones allows server owners to define protected Safe Zones where weapons and violence are restricted. Players entering these zones will have their weapons removed and be protected from all forms of damage including bullets, fire, explosions, and vehicle attacks (VDM).
Key Features
- PolyZone Integration - Define complex multi-point zones of any shape
- Multi-Framework Support - Compatible with QB-Core, QBX-Core, and ESX
- Weapon Restrictions:
- Block all weapons in a zone
- Block only specific weapons
- Job-based bypass permissions
- Complete Protection:
- Bullet proof
- Fire proof
- Explosion proof
- Melee proof
- Anti-VDM (vehicle damage)
- Drown proof
- Optional Healing - Auto-restore health and armor in safe zones
- Visual UI - On-screen indicator when in a safe zone
- Debug Mode - Visualize zone boundaries for easy setup
- Localization - Multi-language support via JSON files
- 10 Pre-configured Zones - Ready-to-use zones for popular locations
Pre-configured Locations
The resource comes with zones pre-configured for:
- Diamond Casino
- PDM (Premium Deluxe Motorsport)
- Benny's Original Motor Works
- MRPD (Mission Row Police Department)
- Vanilla Unicorn
- City Hall
- Bahama Mama's
- Legion Square
- Pillbox Hospital
- Bolingbroke Prison
Need help? Join our Discord (opens in a new tab) for support!
FAQ
How do I define a custom polygon safe zone on my map?
Open config.lua and append an entry to Config.Zones with { name, points = { vector2(x, y), ... }, minZ, maxZ }. PolyZone consumes the point list and builds the boundary at startup. Use the in-game /polyzone_create command shipped with PolyZone to capture the corners visually, then paste them into config.
How do I whitelist a custom job (e.g. private security) to keep weapons in a zone?
Each entry in Config.Zones supports an allowedJobs array. Players whose PlayerData.job.name matches the list can draw and fire weapons inside that zone. The resource re-checks job on every weapon-draw event, so promotions/demotions update behaviour in real time.
Can I disable a safe zone temporarily for a scheduled event (e.g. paintball)?
Yes. Call exports.legends_safezones:SetZoneEnabled("zoneName", false) from a server script. The zone reloads instantly and all players inside receive a notification. Re-enable with the same export when the event ends; no restart required.
How do I detect if a player is inside a safe zone from another resource?
Call exports.legends_safezones:IsPlayerInSafeZone(playerId) on the server or exports.legends_safezones:GetCurrentZone() on the client. Both return a zone name or nil. Useful for combat log detectors, teleport scripts or custom VDM checks that need to know about safe space.
How does the anti-VDM behave and can I tune the detection radius per zone?
When a vehicle travels above Config.VdmSpeedThreshold near a ped inside a zone the server cancels the collision impulse and freezes the vehicle for Config.VdmFreezeDuration seconds. Each zone can override both values via zone.vdm = { speed, freeze } in config so crowded malls can be stricter than quiet parks.