Vehicle gun rack for department vehicles. Players sitting in an allowed vehicle press G to open a clean, transparent panel and store or take weapons and ammo. Stored weapons stand upright between the front seats and ammo boxes lie in the trunk, visible to everyone.
Features
- Opens only from inside the vehicle (driver or passengers) while it stands still
- Job based access: only the jobs you allow can use it, everyone else gets "not allowed"
- Works with ox_inventory, QBCore, Qbox, ESX Legacy, or standalone
- All inventory reads and writes are done on the server; players can only store what they really carry
- A weapon is stored together with the ammo loaded in it (serial, components and ammo are kept); spare ammo is stored separately in any amount
- Weapons visible between the front seats, ammo boxes visible in the trunk; positions are calculated from each vehicle, so new vehicles need no setup
- Several players in the same vehicle see the rack update live
- Rack content is saved per license plate and survives restarts (with a backup copy, so a crash while saving loses nothing)
/trunkviewopens the trunk lid so others can see the ammo- Admin commands
/gunracklistand/gunrackclear <plate>, optional clean-up of racks nobody uses (Config.ExpireDays) - Works together with Armory (Torpil Studio): officers load issued long guns into a rack from the armory
- 9 languages included: English, Turkish, German, French, Spanish, Portuguese (Brazil), Polish, Dutch, Italian.
Config.Locale = 'auto'shows every player the language of their GTA game. Add your own inlocales/ - No dependencies
Requirements
- OneSync (on by default on current servers): rack content is shared with state bags and the server checks vehicles and positions
- FXServer build 5181 or newer
Installation
- Put the
gunrackfolder in yourresourcesfolder. - Add to
server.cfg(after your framework and inventory):
ensure gunrack
- Open
config.luaand set at least:Config.AllowedJobs: jobs that may use the rackConfig.Vehicles: vehicle spawn names that have a rackConfig.Department: name shown on the panelConfig.Locale:'en','tr','de','fr','es','pt','pl','nl','it'or'auto'
Inventory
Config.Inventory = 'auto' detects your inventory:
| Server | Detected as | Notes |
|---|---|---|
| ox_inventory (any framework, Qbox) | ox |
Ammo items from Config.Ammo.ox |
| QBCore with qb-inventory / ps-inventory / lj-inventory | qb |
Weapon items are lowercase (weapon_carbinerifle) |
| ESX Legacy without ox_inventory | esx |
Weapons from the loadout; add ammo items to Config.Ammo.esx if you have them |
| No framework | native |
Uses the game's own weapons. Give the ACE permission gunrack.use to allowed players |
In native mode the server cannot check what a player carries, so use an inventory on public servers. With 'auto', if a framework runs but its inventory is not found (stopped, renamed), the rack stays closed instead of falling back to native. The detected inventory is printed in the server console at start.
ESX loadout: GTA keeps one ammo pool per ammo type. When a weapon goes into the rack while the player still carries another weapon that uses the same ammo, the rounds stay with the player.
Standalone permission example:
add_ace group.police gunrack.use allow
add_principal identifier.license:xxxxxxxx group.police
Configuration
| Option | Meaning |
|---|---|
Config.Locale / Config.AutoFallback |
Language; with 'auto' the language for the server and for games in other languages |
Config.Department |
Name shown on the panel |
Config.Key / Config.KeyLabel |
Key that opens and closes the rack, and how it is written in the hint. Players can rebind it in Settings > Key Bindings > FiveM; the key is saved per player the first time, so changing it later only applies to new players |
Config.HintDuration |
How long the key hint shows after entering the vehicle (only for players allowed to use the rack) |
Config.Inventory |
'auto', 'ox', 'qb', 'esx', 'native' |
Config.Slots |
Slots per vehicle. Lowering it moves stored items into the remaining slots |
Config.ExpireDays |
Empties racks nobody used for this many days (0 = never). Useful when your garage gives random plates |
Config.Weapons |
Weapons that can be stored |
Config.Ammo |
Ammo items per inventory system |
Config.MaxStack |
Most ammo in one slot |
Config.MaxAmmo |
Most rounds stored with one weapon in native mode |
Config.ServerDistance |
Server check: the player must be this close to the vehicle |
Config.MaxSpeed |
The rack does not open above this speed (also checked on the server) |
Config.Visible / Config.VisibleDistance |
Show stored items in the vehicle, and from how far |
Config.Cabin / Config.CabinOverrides |
Weapon position between the seats, per-model fixes (forward, height, side, headroom, maxSink, spacing, rotation) |
Config.TrunkProps / Config.TrunkOverrides |
Ammo box position in the trunk, per-model fixes |
Config.TrunkCommands / Config.TrunkCommandDistance |
Names of the trunk view command and its range |
If weapons sit wrong in one vehicle, fix only that model:
Config.CabinOverrides = {
granger = { height = 0.05, forward = 0.30 },
}
Weapon pictures are in html/img/<WEAPON_NAME>.png. For a new weapon add its picture there; a silhouette is drawn if it is missing.
Random plates: racks are saved per plate. If your police garage (for example qb-policejob) gives a new random plate each time, use fixed plates for department vehicles or set Config.ExpireDays, otherwise weapons left in a car that is gone cannot be taken out again (an admin can still see them with /gunracklist).
Commands
| Command | Who | What |
|---|---|---|
/trunkview |
allowed jobs | opens or closes the trunk lid (no panel) |
/gunracklist [plate] |
ACE gunrack.admin, console |
racks with something in them (in the F8 console) |
/gunrackclear <plate> |
ACE gunrack.admin, console |
empties a rack |
Exports (for other resources)
exports.gunrack:CanRack('WEAPON_CARBINERIFLE') -- can this weapon go in a rack?
exports.gunrack:NearbyRacks(coords, 60.0) -- { { plate, netId, model, distance, free }, ... }
exports.gunrack:AddToRack(plate, { type = 'weapon', name = 'WEAPON_X', ammo = 30, metadata = {} }) -- ok, reason
exports.gunrack:TakeByTag(tag) -- weapon with metadata.armory == tag: ok, plate, metadata
Support
Torpil Studio, torpilstudio.com