You are installing **5code-loadouts** into an existing, live FiveM server that runs QBCore, Qbox or ESX. The owner's server may contain important, irreplaceable work. Your job is to configure this one resource correctly **without causing any damage to anything else.** Follow the rules below exactly.
HARD RULES (do not break these)
1. **Do not delete anything.** No deleting files, folders, database tables, columns, rows, config entries, or lines in server.cfg. Installation is additive only.
2. **Stay inside the 5code-loadouts folder.** Do not modify, move, rename, or delete any other resource. The only file outside this folder you may touch is server.cfg, and only to **append** the lines in step 6 — after showing the owner and getting an OK.
3. **Never run destructive database commands.** No DROP, TRUNCATE, DELETE, ALTER ... DROP, or UPDATE/DELETE without explicit owner approval. The schema in sql/install.sql is already idempotent (CREATE TABLE IF NOT EXISTS, INSERT IGNORE) and runs automatically — you normally do **not** need to run any SQL by hand.
4. **Do not rename the resource folder.** It must stay exactly 5code-loadouts or the UI images break (nui://5code-loadouts/... is hardcoded).
5. **Do not create or modify items in other inventory resources** (e.g. editing qb-core/shared/items.lua, ox_inventory/data/items.lua) without explicit approval. If items are missing, **report them** and let the owner add them.
6. **Ask, don't guess.** When a value depends on the owner's server (see the questions below), ask the owner. Do not invent coordinates, identifiers, job names, or webhook URLs.
7. **Do not restart the whole server.** At most, suggest the owner run ensure 5code-loadouts (or refresh; ensure 5code-loadouts) in the live console.
8. **Back up before editing.** Before changing config.lua or server.cfg, note the original (or save a .bak copy) so the owner can revert.
9. **If anything is ambiguous or risky, stop and ask** rather than proceeding.
QUESTIONS TO ASK THE OWNER BEFORE CONFIGURING
Ask all of these up front and wait for answers (use sensible defaults only if the owner says "use defaults"):
1. **Framework?** QBCore, Qbox or ESX? config.lua ships with Config.Framework = 'auto', which detects the core that is started when 5code-loadouts starts (qbx_core first, then es_extended, otherwise QBCore). Keep 'auto' unless the owner wants it pinned to 'qb-core', 'qbx_core' or 'esx'.
2. **Inventory system?** qb-inventory, ox_inventory, or codem-inventory? qb-inventory works through qb-core, so it is for QBCore; on Qbox or ESX use ox_inventory or codem-inventory.
3. **Target / interaction?** qb-target, ox_target, or interact (E-key)?
4. **Notification system?** qb, codem-notification, or esx? qb uses qb-core's notify, so it is for QBCore, and for Qbox only with the qb-core compatibility shim. esx needs es_extended, so on ESX use esx. codem-notification needs the codem-notification resource and does not depend on the framework. config.lua also lists ox_lib, but v1.2.0 does not load ox_lib (fxmanifest.lua has no '@ox_lib/init.lua'), so do not choose it.
5. **Police job name?** (default police) — and confirm the police job's grade numbers in the framework's job list (on QBCore that is qb-core/shared/jobs.lua; on Qbox or ESX, wherever that framework defines its jobs: ask the owner if unsure) so Config.GradeNames / Config.BossGrades line up.
6. **Armory NPC location(s)?** Ask for one or more vector4(x, y, z, heading) — the owner can have several stations, all opening the same armory (Config.NPCs).
7. **Which grades are bosses** (can manage loadouts)? → Config.BossGrades.
8. **Admin license identifier(s)** for the loadouts.admin ACE permission.
9. **Discord webhook URL** for audit logs? (Optional — leave the placeholder to disable.)
10. **Do the required items exist?** Share the item list from Config.Equipment and ask the owner to confirm each is registered in their inventory. List any that are missing.
INSTALLATION PROCEDURE
1. **Verify placement.** Confirm the folder is named 5code-loadouts and sits in a loaded resources path. Do not move other resources to make room.
2. **Confirm dependencies** are present and load first: oxmysql, then the framework's core (qb-core on QBCore, qbx_core on Qbox, es_extended on ESX), plus the owner's chosen target (none for interact) and inventory. The core must be started before 5code-loadouts: 'auto' only detects a core that is already started. If any are missing, report it and pause.
3. **Edit config.lua only**, applying the owner's answers above. Change values in place; do not remove unrelated config. Keep the resource name references intact.
4. **Check the item list.** Cross-reference every item in Config.Equipment against the owner's inventory items. Produce a clear list of any missing items for the owner to add — do not add them yourself unless explicitly told to.
5. **ACE permission.** Show the owner the exact line to add to server.cfg (add_ace identifier.license:... loadouts.admin allow) and let them confirm before appending it.
6. **server.cfg ensure line.** Append ensure 5code-loadouts **after** its dependencies. Show the diff and get an OK before saving. Do not reorder or remove existing lines.
7. **Database.** Do nothing destructive. The tables auto-create on first start. Only if the owner explicitly asks should you run sql/install.sql manually.
8. **Start the resource.** Suggest the owner run ensure 5code-loadouts in the console. Confirm the logs show "Schema ensured." and "Resource started successfully."
WHEN FINISHED
Give the owner a short summary containing:
- Which config.lua values you set (and their previous values).
- The exact server.cfg lines you added.
- Any **missing items** they still need to register before loadouts will work.
- An in-game test checklist: set police job → go to NPC coords → deploy a loadout → return it.
If you could not complete a step safely, say so explicitly and explain what you need from the owner — never paper over a problem with a destructive shortcut.