Installation

3 min readUpdated Today

Overview

ml_turret is a multi-caliber defence system for FiveM. It handles placeable turrets spawned from kit items, admin-defined fixed turrets, AI target acquisition, manual control with a first-person cabin view, group invites, destruction/rebuild flow and a tactical UI. Runs on ESX, QBCore, Qbox and standalone through ml_bridge.

Quick Start

  1. Download from CFX Portal
  2. Extract to your resources folder as ml_turret
  3. Add to server.cfg:
server.cfg
1ensure oxmysql
2ensure ox_lib
3ensure ml_bridge
4ensure ml_turret
Load Order

ml_turret must start AFTER ml_bridge, ox_lib and oxmysql. Starting earlier will fail the schema install.

Database

The schema installs automatically on first start. No SQL file to import.

ml_turrets: Stores every placed and fixed turret: type, coords, owner, health, fuel, loaded ammo, AI state, destruction flag

The query uses CREATE TABLE IF NOT EXISTS, so subsequent restarts are a no-op and never touch existing rows.

Item Registration

Copy the entries in _INSTALL/items.lua into your inventory definition.

Required items:

  • bazq_heavy_kit: placement kit for the Bazq heavy turret
  • cctv_sentry_kit: placement kit for the CCTV sentry
  • ammo_9mm, ammo_556, ammo_762, ammo_50, ammo_minigun_belt: calibres used by the default turrets
  • repair_kit, welding_torch: repair items for damaged turrets
  • turret_rebuild_kit: item consumed to rebuild a destroyed turret from rubble
  • diesel, jerrycan_large: fuel items

All item names are configurable in Config.Turrets[type] and Config.Ammo. Icons resolve automatically through ml_bridge, no manual icon paths required.

Props

The bazq_heavy turret type uses custom props sold separately by the prop author. You must purchase and install the Bazq Turret Prop Pack to render the heavy turret.

  • Models required: bazq-turret1b_base, bazq-turret1b_gunner, bazq-turret1b_barrel
  • The stream resource must load BEFORE ml_turret in your server.cfg
  • The CCTV sentry type uses a single vanilla GTA prop and does NOT require the Bazq pack
Two purchases

The script (ml_turret) and the 3D asset (Bazq Prop Pack) are sold independently. Both must be on your server for the heavy turret to work.

Audio

Drop the turret sound files (.ogg/.wav/.mp3) into the sounds/ folder. If xsound is not installed, set Config.Sounds.enabled = false in shared/config.lua.

Verify

After starting, the server console prints:

lua
1[ml_turret] Database ready (schema checked/installed)
2[ml_turret] Loaded N placeable turret(s) from DB
3[ml_turret] Loaded M fixed turret(s) from config
4[ml_turret] ml_turret ready - K total turret(s) active

Give yourself a kit item and use it in-game:

lua
1/giveitem <playerId> bazq_heavy_kit 1
2/giveitem <playerId> ammo_762 10
  • Schema install fails: check the oxmysql connection string. The console will print the exact MySQL error.
  • Kit item does nothing when used: verify the item is registered in your inventory and the item field on the turret type matches the inventory item name.
  • Turret spawns but only the base prop is visible: the Bazq stream resource is not loaded or started after ml_turret. Move it above in server.cfg.
  • AI does not engage zombies: hrs_zombies requires the state bag patch documented in Config.HRS. Without it, only peds whose model is in Config.HRS.zombieModels count as zombies.
  • UI is blank: the web/ folder did not copy fully. Re-extract the resource so the entire web/ folder is present, then restart ml_turret.