Installation
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
- Download from CFX Portal
- Extract to your
resourcesfolder asml_turret - Add to
server.cfg:
1ensure oxmysql
2ensure ox_lib
3ensure ml_bridge
4ensure ml_turretml_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 turretcctv_sentry_kit: placement kit for the CCTV sentryammo_9mm,ammo_556,ammo_762,ammo_50,ammo_minigun_belt: calibres used by the default turretsrepair_kit,welding_torch: repair items for damaged turretsturret_rebuild_kit: item consumed to rebuild a destroyed turret from rubblediesel,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_turretin yourserver.cfg - The CCTV sentry type uses a single vanilla GTA prop and does NOT require the Bazq pack
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:
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) activeGive yourself a kit item and use it in-game:
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
itemfield 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 inserver.cfg. - AI does not engage zombies:
hrs_zombiesrequires the state bag patch documented inConfig.HRS. Without it, only peds whose model is inConfig.HRS.zombieModelscount 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.