F5 StudioF5 Studio
Skip to main content

Zone Creation

There are three ways to create safezones:

  1. In-game creators — Interactive polygon and circle zone builders with fly mode
  2. Admin panel — NUI-based management interface
  3. Static configuration — Define zones directly in config.lua

In-Game Polygon Creator

The polygon creator lets you fly around the map and place points to define a polygon boundary.

Starting the Creator

The polygon creator is launched from the Admin Panel when creating a new polygon zone. It can also be triggered via the client event:

TriggerEvent('f5_safezones:create_zone')

Controls

Movement

KeyAction
W / A / S / DMove forward / left / backward / right (fly mode)
Q / EMove up / down
Left ShiftFly faster (3x speed)
Left CtrlFly slower (0.25x speed)

Point Placement

KeyAction
FPlace a new point at crosshair position, or move the selected point to crosshair if a point is selected
XRemove the last placed point
DeleteDelete the currently selected point (minimum 3 points must remain)

Point Selection

KeyAction
TabSelect the next point (cycles through all points)
SpaceDeselect the current point

History

KeyAction
ZUndo last action (up to 50 steps)
YRedo last undone action

General

KeyAction
GToggle marker preview (shows how the zone will look)
EnterConfirm the polygon (minimum 3 points required)
BackspaceCancel and exit the creator

How It Works

  1. When activated, your player becomes invisible and enters fly mode
  2. A crosshair appears at the point you're aiming at on the ground
  3. Press F to place polygon vertices — they appear as numbered orange markers connected by yellow lines
  4. Use Tab to select existing points — selected points turn green with a green label
  5. With a point selected, press F to move it to the crosshair position, or Delete to remove it
  6. Press Space to deselect and return to placement mode
  7. Use Z / Y to undo or redo any changes
  8. Once you have 3+ points, press G to preview the zone's marker rendering
  9. Press Enter to confirm — the points are sent back to the admin panel for final configuration
  10. Press Backspace at any time to cancel
tip

Place points in order around the perimeter. The polygon automatically connects the last point to the first. Use point selection (Tab) and movement (F) to fine-tune positions after placing them.

In-Game Circle Creator

The circle creator lets you define a center point and radius for circle zones.

Starting the Creator

Launched from the Admin Panel when creating a new circle zone. It can also be triggered via the client event:

TriggerEvent('f5_safezones:create_circle_zone')

Controls

Movement

KeyAction
W / A / S / DMove forward / left / backward / right (fly mode)
Q / EMove up / down
Left ShiftFly faster (3x speed)
Left CtrlFly slower (0.25x speed)

Center & Radius

KeyAction
FSet center point at crosshair position (only when no center is set yet)
XReset center point (allows placing a new one with F)
RSet radius to distance between center and crosshair
Scroll UpIncrease radius by 5m (+ Shift = 25m, + Ctrl = 1m)
Scroll DownDecrease radius by 5m (+ Shift = 25m, + Ctrl = 1m)

History

KeyAction
ZUndo last action (up to 50 steps)
YRedo last undone action

General

KeyAction
GToggle marker preview
EnterConfirm the circle zone
BackspaceCancel and exit the creator

How It Works

  1. Enter fly mode — your player becomes invisible
  2. Aim at the ground and press F to set the center point (green crosshair)
  3. A blue circle outline with radius lines appears around the center
  4. Adjust the radius using Scroll Up/Down or press R to set it to the distance from center to your crosshair
  5. Use Z / Y to undo or redo center and radius changes
  6. Press G to preview the zone marker
  7. Press Enter to confirm — data is sent back to the admin panel

Radius Limits

ConstraintValue
Creator minimum0.1 m
Server validation minimum10.0 m
Maximum radius500.0 m
Default step5.0 m
Shift step25.0 m
Ctrl step1.0 m
caution

The in-game creator allows placing a radius as small as 0.1m, but the server rejects zones with a radius below 10m during validation. Always use a radius of at least 10m when saving a zone.

Editing Existing Zones In-Game

Both creators support an edit mode for modifying existing zones. When launched from the admin panel while editing a zone, the creator starts with the existing zone data pre-loaded.

How Edit Mode Works

  1. Open the Admin Panel and click Edit on a zone
  2. Click Use In-Game Creator — the creator launches with the zone's existing data:
    • Polygon zones: All existing points are loaded and displayed as editable markers
    • Circle zones: The existing center point and radius are pre-set
  3. You are automatically teleported to the zone's location
  4. Make your changes using the standard creator controls
  5. Press Enter to confirm — the updated data is sent back to the admin panel
  6. Press Backspace to cancel and discard changes

Polygon Edit Mode Features

  • Point selection: Use Tab to cycle through existing points, Space to deselect
  • Point movement: Select a point with Tab, then press F to move it to the crosshair position
  • Point deletion: Select a point and press Delete to remove it (minimum 3 must remain)
  • Add new points: With no point selected, press F to append a new point
  • Auto-level: When edit mode starts, the Z coordinates of all existing points are automatically adjusted to match the ground level at each position

Notifications

Both creators display on-screen notifications for all actions — point added, point moved, point deleted, undo/redo, center set, radius changed, etc. Notifications are throttled to avoid spam (one per 300ms).

Creating via Admin Panel

The admin panel provides a visual interface for creating zones. See Admin Panel for full details.

  1. Open the panel with /szadmin
  2. Click "Create Zone"
  3. Choose zone type (circle or polygon)
  4. Click "Use In-Game Creator" to launch the appropriate creator, or enter coordinates manually
  5. Configure all zone options (protection, markers, blips)
  6. Save the zone

Zones created through the admin panel are saved to data/zones.json and persist across server restarts.

Static Configuration

Define zones directly in config.lua for zones that should always exist and never be deleted through the admin panel.

config.lua
Config.Safezones = {
{
name = "Legion Square",
type = "circle",
coords = vector3(195.17, -933.77, 29.7),
radius = 50.0,
minZ = -50,
maxZ = 150,
showBlip = true,
showMarker = true,
blipName = "Safe Zone - Legion Square",
enableInvincibility = true,
enableGhosting = true,
preventVehicleDamage = true,
disableVehicleWeapons = true,
collisionDisabled = false,
renderDistance = 50.0
},
-- Add more zones here
}
caution

Config zones cannot be deleted through the admin panel. They can only be modified by editing config.lua and restarting the resource. To remove a config zone, delete it from the Config.Safezones table.

Zone Validation

All zones (created via the admin panel or zones.json) are validated server-side before being accepted.

Name Rules

  • Length: 3–50 characters
  • Sanitization: Only letters, numbers, spaces, hyphens (-), and underscores (_) are kept — all other characters are stripped automatically
  • Uniqueness: Case-insensitive — "Hospital" and "hospital" are considered duplicates

Circle Constraints

FieldConstraint
coords.x, coords.y, coords.zRequired, must be numeric
radius10.0 – 500.0 (server rejects values outside this range)

Polygon Constraints

FieldConstraint
pointsMinimum 3 points, each with numeric x and y
minZRequired, must be numeric
maxZRequired, must be numeric, must be greater than minZ

Marker Config Validation

If markerConfig is provided:

  • type must be a valid key in Config.MarkerTypes (1–6), otherwise defaults to Config.DefaultMarker.type
  • color.r, color.g, color.b are required and clamped to 0–255
  • color.a defaults to 100 if not provided, clamped to 0–255

Save System

Custom zone data is persisted to data/zones.json with the following reliability features:

  • Debounced writes — saves are delayed by 1 second to batch rapid changes (e.g., multiple edits in quick succession)
  • Automatic backup — a data/zones.json.backup is created before each write
  • Restore on failure — if the write fails, the system automatically restores from the backup

Zone activation states are stored separately in data/zone_states.json and are also persisted immediately on change.

Custom Zones File

Zones created through the admin panel are stored in data/zones.json. This file is automatically managed — you generally don't need to edit it manually, but you can.

data/zones.json
[
{
"name": "My Custom Zone",
"type": "polygon",
"points": [
{"x": 236.45, "y": -1064.96},
{"x": 204.24, "y": -1049.54},
{"x": 213.88, "y": -1023.30}
],
"minZ": 26.1,
"maxZ": 30.3,
"showBlip": true,
"showMarker": true,
"enableInvincibility": true,
"enableGhosting": true,
"createdBy": "AdminName",
"createdAt": 1771680006
}
]

See Save System above for details on backup and restore behavior.

Zone Activation States

Zone activation states (active/inactive) are stored separately in data/zone_states.json. This allows you to temporarily disable zones without deleting them.

data/zone_states.json
{
"Legion Square": true,
"My Custom Zone": false
}

See Also