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

# Installation & Configuration

### Downloading Dependencies

{% stepper %}
{% step %}

### **Oxmysql**

{% embed url="<https://github.com/overextended/oxmysql>" %}
{% endstep %}
{% endstepper %}

If you use `ox_lib` notifications:

```shellscript
ensure ox_lib
ensure oxmysql
ensure izaap_safezone
```

***

**SQL**

Import the included SQL file into your database:

```sql
CREATE TABLE IF NOT EXISTS `izaap_safezones` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `label` VARCHAR(80) NOT NULL DEFAULT 'SafeZone',
  `text` VARCHAR(255) NOT NULL DEFAULT 'Estás en una zona segura',
  `points` LONGTEXT NOT NULL,

  `show_draw` TINYINT(1) NOT NULL DEFAULT 1,
  `ignore_admin` TINYINT(1) NOT NULL DEFAULT 0,

  `zone_height` DECIMAL(8,2) NOT NULL DEFAULT 30.00,
  `draw_color_r` INT NOT NULL DEFAULT 0,
  `draw_color_g` INT NOT NULL DEFAULT 220,
  `draw_color_b` INT NOT NULL DEFAULT 95,

  `show_blip` TINYINT(1) NOT NULL DEFAULT 0,
  `blip_sprite` INT NOT NULL DEFAULT 487,
  `blip_color` INT NOT NULL DEFAULT 2,
  `blip_scale` DECIMAL(5,2) NOT NULL DEFAULT 0.75,
  `blip_label` VARCHAR(80) NOT NULL DEFAULT 'SafeZone',

  `invincible` TINYINT(1) NOT NULL DEFAULT 1,
  `disable_weapons` TINYINT(1) NOT NULL DEFAULT 1,
  `disable_shoot` TINYINT(1) NOT NULL DEFAULT 1,
  `disable_driveby` TINYINT(1) NOT NULL DEFAULT 1,
  `disable_idle_cam` TINYINT(1) NOT NULL DEFAULT 1,
  `disable_jump` TINYINT(1) NOT NULL DEFAULT 0,
  `quiet_footsteps` TINYINT(1) NOT NULL DEFAULT 0,
  `ghost_mode` TINYINT(1) NOT NULL DEFAULT 0,
  `player_move_rate` DECIMAL(5,2) NOT NULL DEFAULT 0.00,

  `allow_weapon_whitelist` TINYINT(1) NOT NULL DEFAULT 1,
  `allow_job_whitelist` TINYINT(1) NOT NULL DEFAULT 1,
  `area_notify` TINYINT(1) NOT NULL DEFAULT 1,
  `log_join_exit` TINYINT(1) NOT NULL DEFAULT 1,
  `kick_afk` INT NOT NULL DEFAULT 0,
  `kick_notify` TINYINT(1) NOT NULL DEFAULT 1,

  `enable_speed_limit` TINYINT(1) NOT NULL DEFAULT 1,
  `speed_limit` INT NOT NULL DEFAULT 30,

  `affect_vehicles` TINYINT(1) NOT NULL DEFAULT 1,
  `vehicle_invincible` TINYINT(1) NOT NULL DEFAULT 1,
  `vehicle_alpha` INT NOT NULL DEFAULT 255,
  `vehicle_auto_lock` TINYINT(1) NOT NULL DEFAULT 0,
  `disable_vehicle` TINYINT(1) NOT NULL DEFAULT 0,
  `vehicle_collision` TINYINT(1) NOT NULL DEFAULT 1,

  `affect_peds` TINYINT(1) NOT NULL DEFAULT 0,
  `ped_invincible` TINYINT(1) NOT NULL DEFAULT 1,
  `ped_alpha` INT NOT NULL DEFAULT 255,
  `ped_disable_events` TINYINT(1) NOT NULL DEFAULT 1,
  `ped_quiet` TINYINT(1) NOT NULL DEFAULT 1,
  `ped_collision` TINYINT(1) NOT NULL DEFAULT 1,

  `affect_player_peds` TINYINT(1) NOT NULL DEFAULT 1,
  `player_ped_quiet` TINYINT(1) NOT NULL DEFAULT 0,

  `entity_refresh_rate` INT NOT NULL DEFAULT 1000,

  `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

***

**Permissions**

SafeZone creator permissions are configured from `config.lua`.

```lua
Config.AdminGroups = {
    'god',
    'admin',
    'superadmin',
}

Config.AcePermission = 'izaap_safezone.admin'
```

Optional ACE permission:

```shellscript
add_ace group.admin izaap_safezone.admin allow
add_principal identifier.license:YOUR_LICENSE_HERE group.admin
```

***

**Configuration**

Open `config.lua` and configure the script:

```lua
Config.Framework = 'auto' -- 'auto', 'qb', 'qbx', 'esx', 'standalone'
Config.Lang = 'en' -- 'en' or 'es'

Config.NotifyType = 'default' -- 'default', 'ox', false
Config.AlertUI = true

Config.Commands = {
    CreatorZone = 'creatorzone',
}
```

***

**Command**

Default creator command:

```shellscript
/creatorzone
```

From this menu you can create and edit safezones, draw points, configure blips, speed limits, vehicle options, ped options, AFK kick, notifications and more.

***

* Import the SQL.
* Start `oxmysql` before `izaap_safezone`.
* Configure your framework in `config.lua`.
* Configure staff permissions.
* Use `/creatorzone` to open the safezone creator.

***
