Blog

FiveM Vehicle Gun Rack: How Gunrack Works

On roleplay servers, a police car trunk or cabin is usually just a menu; you cannot see what the car carries. Gunrack is a FiveM script that fills that gap: it adds a real gun rack to department vehicles and shows the stored weapons and ammo inside the car. This post explains how the script works and why it is built this way.

Published:

The rack opens from inside the vehicle

An officer sits in an allowed vehicle, the vehicle is stopped, and they press G; a transparent panel opens on the right side of the screen. One side shows the rack slots, the other shows the weapons and ammo they carry. One click stores or takes an item.

Since it opens from any seat, the driver and the passenger share the same rack. When someone stores an item, the panel updates for everyone in the car at the same time.

Weapons show between the seats, ammo in the trunk

Stored weapons stand upright between the front seats and ammo packs sit on the trunk floor. Positions are calculated from each vehicle's own seat points and size, so they fit different police vehicles without manual tuning; in vehicles with a low roof, weapons are lowered automatically.

The /trunkview command opens only the trunk lid, so others can see what is in the trunk without opening the panel.

A weapon is stored with its ammo

A weapon goes into the rack with the ammo loaded in it and comes back with the same ammo. On servers using ox_inventory or QBCore, the weapon's serial number and attachments are kept as well. Spare ammo is listed separately and any amount can be stored.

Every action is checked on the server

On public servers, the biggest risk is trusting the client when it says "I have this weapon". On every store and take request, Gunrack checks the job, the vehicle, which vehicle the player sits in, the distance and what is really in the inventory, on the server. Requests are rate limited and amounts are clamped on the server.

Rack state reaches players only through entity state bags written by the server. There is no per-frame loop on the client; the resmon value we measured in game on our test server is 0.00 ms on foot and 0.01 ms in a loaded rack vehicle.

ESX, QBCore, Qbox and ox_inventory

Gunrack detects the framework and inventory on the server it runs on: ESX Legacy, QBCore, Qbox or standalone; ox_inventory, qb-inventory or the game's own weapons as the inventory. It needs no extra dependency or database table.

The script is protected with Cfx asset escrow, but the files you may need to change for your server stay open: config.lua, the language files and the framework and inventory bridges. English and Turkish language files are included.

Product

Gunrack

Vehicle gun rack for FiveM. Officers store weapons and ammo inside department vehicles.

Related service

Custom FiveM Script Development

Tell us the idea and we will shape the scope and budget together. On weekdays we usually reply within one business day.

  • Free quote
  • Usually a reply within one business day
  • Scope and price agreed before we start

or write to us directly: contact@torpilstudio.com

WhatsApp: +90 546 401 33 90Book a free 15-minute call →

Tell us about your project

Your projectStep 1 of 2

What do you need?
Your budget (optional)