Configuration

Configuration

All configuration for legends_safezones is done in the config/config.lua and client/editable.lua files.

Main Configuration

Location: config/config.lua

Config.Framework

Config.Framework = "qb"

Description: Determines which framework to use for job checking.

Type: string

Options:

ValueDescription
"qb"Use QB-Core
"qbx"Use QBX-Core
"esx"Use ESX

Config.ShowUIinSafeZone

Config.ShowUIinSafeZone = true

Description: Shows a visual UI indicator when players are inside a safe zone.

Type: boolean

Default: true

The UI displays:

  • "SAFE ZONE" title
  • "Weapons & Violence Disabled" subtitle

Config.RestoreHealthInSafeZone

Config.RestoreHealthInSafeZone = false

Description: Automatically restores player health to maximum when inside safe zones.

Type: boolean

Default: false

⚠️

Warning: Enabling this can be abused by players for free healing. Only enable if this is intentional behavior for your server.


Config.RestoreArmorInSafeZone

Config.RestoreArmorInSafeZone = false

Description: Automatically restores player armor to maximum when inside safe zones.

Type: boolean

Default: false

⚠️

Warning: Enabling this can be abused by players for free armor. Only enable if this is intentional behavior for your server.


Config.Lang

Config.Lang = "en"

Description: Language for notifications and UI text.

Type: string

Default: "en"

Language files are located in locales/. To add a new language, create a JSON file (e.g., locales/es.json) with the required translations.


Config.Debug

Config.Debug = false

Description: Enables global debug mode for all zones.

Type: boolean

Default: false


Restricted Zones

Config.RestrictedZones

The main configuration for defining protected areas. Each zone is a table with the following properties:

Config.RestrictedZones = {
    {
        name = "DiamondCasino",
        debug = false,
        points = {
            vector2(870.47, 16.06),
            vector2(947.22, 118.22),
            vector2(1035.37, 64.72),
            vector2(970.77, -44.91),
        },
        minZ = 65.0,
        maxZ = 135.0,
        allWeapons = true,
        weapons = {},
        bypassJobs = { "police" },
        antiVDM = true
    },
}

Zone Properties

PropertyTypeDescription
namestringUnique identifier for the zone
debugbooleanEnable debug visualization for this specific zone
pointstableArray of vector2 coordinates defining zone boundaries
minZnumberMinimum height (ground level)
maxZnumberMaximum height (ceiling level)
allWeaponsbooleanIf true, blocks ALL weapons in zone
weaponstableList of specific weapon hashes to block (used when allWeapons = false)
bypassJobstableJobs that can use weapons in this zone
antiVDMbooleanEnable vehicle damage protection

Creating Custom Zones

Step 1: Get Coordinates

Use a tool like PolyZone Creator (opens in a new tab) or manually collect coordinates at each corner of your desired zone.

Step 2: Define the Zone

{
    name = "MyCustomZone",  -- Unique name
    debug = true,           -- Enable while setting up
    points = {
        vector2(x1, y1),    -- Corner 1
        vector2(x2, y2),    -- Corner 2
        vector2(x3, y3),    -- Corner 3
        vector2(x4, y4),    -- Corner 4
    },
    minZ = 20.0,            -- Ground level
    maxZ = 50.0,            -- Ceiling level
    allWeapons = true,
    weapons = {},
    bypassJobs = { "police", "ambulance" },
    antiVDM = true
}

Step 3: Test and Adjust

  1. Enable debug = true for the zone
  2. Restart the resource
  3. Check if the zone covers the intended area
  4. Adjust coordinates as needed
  5. Set debug = false when finished

Blocking Specific Weapons

To only block certain weapons instead of all:

{
    name = "PartialWeaponZone",
    -- ... other properties
    allWeapons = false,      -- Disable blocking all weapons
    weapons = {
        `WEAPON_PISTOL`,
        `WEAPON_SMG`,
        `WEAPON_ASSAULTRIFLE`,
        `WEAPON_SNIPERRIFLE`,
    },
    -- ...
}

When allWeapons = false, only weapons listed in the weapons table will be blocked. All other weapons can be used.


Bypass Jobs

Define which jobs can use weapons inside safe zones:

bypassJobs = { "police", "ambulance", "sheriff" }

Players with these jobs will:

  • Keep their weapons when entering the zone
  • Be able to use weapons normally
  • Still receive entity protection (damage immunity)

Entity Protection Settings

Location: client/editable.lua

These settings control what types of damage protection are applied to players in safe zones.

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

EntityProofs.CollisionProof

EntityProofs.CollisionProof = true
⚠️

Important: If you're experiencing issues with vehicle entry, trunk access, or other vehicle interactions inside safe zones, set CollisionProof = false.

Note: Setting this to false will reduce Anti-VDM effectiveness - vehicles will no longer pass through players, but players will still be protected from damage.


Localization

Location: 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 in locales/ (e.g., es.json)
  2. Translate all strings
  3. Set Config.Lang = "es" in config

Example Configurations

Hospital Safe Zone (Full Protection)

{
    name = "Hospital",
    debug = false,
    points = {
        vector2(275.71, -615.22),
        vector2(293.09, -539.1),
        vector2(388.79, -573.18),
        vector2(352.06, -653.81),
    },
    minZ = 15.78,
    maxZ = 104.61,
    allWeapons = true,
    weapons = {},
    bypassJobs = { "police", "ambulance" },
    antiVDM = true
}

Nightclub (No Heavy Weapons)

{
    name = "Nightclub",
    debug = false,
    points = { ... },
    minZ = 20.0,
    maxZ = 50.0,
    allWeapons = false,
    weapons = {
        `WEAPON_ASSAULTRIFLE`,
        `WEAPON_CARBINERIFLE`,
        `WEAPON_SNIPERRIFLE`,
        `WEAPON_RPG`,
        `WEAPON_GRENADELAUNCHER`,
    },
    bypassJobs = { "police" },
    antiVDM = true
}

VIP Area (Police Only)

{
    name = "VIPArea",
    debug = false,
    points = { ... },
    minZ = 0.0,
    maxZ = 100.0,
    allWeapons = true,
    weapons = {},
    bypassJobs = { "police", "security" },
    antiVDM = true
}

Need Help?

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


Legends Store - Premium FiveM Scripts