> For the complete documentation index, see [llms.txt](https://bros-development.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bros-development.gitbook.io/documentation/scripts/brosdev-safezonecreator/installation.md).

# 📦 Installation

🔧 Installation Guide

Follow the steps below carefully to install **BrosDev-SafeZoneCreator** correctly on your FiveM server.

***

📥 **Download Script**\
To download the files required for **BrosDev-SafeZoneCreator**, you must access the official **Cfx.re Portal**, where all FiveM assets purchased through Tebex are securely managed and delivered.

All granted assets are stored inside your account dashboard and can be accessed directly through the official portal below:

🔗 <https://portal.cfx.re/assets/granted-assets>

These files include the complete resource package such as scripts, UI components, configuration files, and database structure required for the proper installation and functionality of the system.

After downloading, extract the archive to proceed with the installation steps.

***

📂 **Step 2 — Place in Resources Folder**\
Move the extracted folder into your server’s resources directory.

Example:

```
resources/
└── [brosdevelopment]/
    └── BrosDev-SafeZoneCreator/
```

Make sure the folder name remains exactly:\
**BrosDev-SafeZoneCreator**\
Do not rename the resource.

***

🗄️ **Step 3 — Import the Database**\
Inside the resource you will find:

```
sql/install.sql
```

Import this SQL file into your database using:

* phpMyAdmin
* HeidiSQL
* Navicat
* DBeaver
* Command Line

Example command:

```bash
mysql -u root -p your_database < install.sql
```

This will automatically create all required database tables for:

* Safe zone data storage
* Zone groups system
* Zone templates system
* Logs & audit history

***

⚙️ **Step 4 — Configure server.cfg**\
Add the resource to your `server.cfg`.

Recommended startup order:

```cfg
ensure oxmysql
ensure ox_lib

# Framework (auto-detected supported)
ensure qbx_core
# or qb-core / es_extended

# Safe Zone Creator
ensure BrosDev-SafeZoneCreator
```

⚠️ **Important:**\
Your framework and dependencies **must start before** BrosDev-SafeZoneCreator for proper detection and functionality.

***

🛠️ **Step 5 — Configure config.lua**\
Open:

```
BrosDev-SafeZoneCreator/config.lua
```

Set your framework and integrations if you want manual control:

```lua
Config.Framework = 'auto'
-- 'auto' | 'qbcore' | 'qbx' | 'esx' | 'standalone'
```

You can also adjust:

* Admin permissions
* Default zone behavior
* UI settings
* Notifications
* Webhook logging
* Blip system
* Visualization options

All features are fully configurable without touching core logic.

***

🔐 **Step 6 — Setup Admin Permissions**\
Grant access to `/safezonecreator`.

#### ACE Permission Method

Add to `server.cfg`:

```cfg
add_ace group.admin command.safezonecreator allow
```

Then assign yourself:

```cfg
add_principal identifier.license:YOUR_LICENSE_HERE group.admin
```

***

🎨 **Step 7 — Add Optional Assets**\
Inside:

```
html/assets/
```

You can add custom assets such as:

* Map image → `map.png`
* Blip icons → `blip_sprites/`
* UI customizations (CSS/JS edits allowed)

📌 Optional map calibration improves zone visualization accuracy.

***

🚀 **Step 8 — Start the Resource**\
Restart your server or run:

```bash
restart BrosDev-SafeZoneCreator
```

If installed correctly, you should see:

```
[BrosDev SafeZone] =========================================
[BrosDev SafeZone]  Bros Development - Safe Zone Creator
[BrosDev SafeZone]  Resource loaded successfully!
[BrosDev SafeZone] =========================================
```

***

🧭 **Step 9 — Open the Admin Panel**\
In-game, use:

```
/safezonecreator
```

From here you can:

* Create new zones using freecam
* Edit existing zones live
* Enable/disable zones
* Configure restrictions & features
* Manage blips and map visualization
* Clone / export / import zones
* Teleport to zone locations
* View logs and analytics

No restart required for most changes.

***

🎮 **Player Experience**\
Players are automatically affected by zones based on rules you set — no commands required.

***

⚠️ **Important Notes**

* Ensure `ox_lib` and `oxmysql` are started first
* Do not rename the resource folder
* Use `Config.Framework = 'auto'` for easiest setup
* Clear FiveM cache if UI does not load properly after updates
* Calibrate map view if using custom map image

***
