Gunplug
Installation
Run the SQL, add the items and images, set The Plug's location and give someone the job.
Steps
1
Copy the resource
Place the
dh_gunplug folder in your resources directory.2
Run the SQL
Import
INSTALL/SQL.sql. Safe to re-run.3
Add the items
Merge
INSTALL/dh_ox_items.lua into the table in ox_inventory/data/items.lua — don't overwrite the whole file. It adds the bench, all parts and the 35 weapons.4
Add the ammo
The AK74 and Draco variants use
ammo-rifle2, which isn't a stock ox_inventory item. Add it yourself (example below). ammo-9, ammo-rifle, ammo-shotgun and ammo-44 are stock.5
Add the images
Copy everything in
INSTALL/images/ into ox_inventory/web/images/. Weapon images are case-sensitive (WEAPON_GLOCK17.png).6
Optional: magazines
Paste
INSTALL/dh_gunplug_weapon_accs.lua into items.lua if you want the 4 extended/drum mag items registered. They aren't sold by The Plug.7
Set The Plug's location
Set
Config.Supplier.coords, and turn on Config.SupplierBlip if you want a map blip.8
Create the job
Create a
gunplug job in your framework, or change Config.Job to an existing one.9
Add to server.cfg
After dh_bridge and its dependencies, then restart.
SQL
INSTALL/SQL.sql
CREATE TABLE IF NOT EXISTS `dh_gunplug_tables` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`owner_identifier` varchar(60) NOT NULL,
`x` float NOT NULL,
`y` float NOT NULL,
`z` float NOT NULL,
`heading` float NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `dh_gunplug_craft_cycle` (
`id` tinyint(3) unsigned NOT NULL,
`cycle_id` int(10) unsigned NOT NULL DEFAULT 1,
`cycle_started_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `dh_gunplug_craft_counts` (
`identifier` varchar(64) NOT NULL,
`recipe_id` varchar(64) NOT NULL,
`cycle_id` int(10) unsigned NOT NULL DEFAULT 1,
`count` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`identifier`, `recipe_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ammo-rifle2 example
ox_inventory/data/items.lua
['ammo-rifle2'] = { label = '7.62mm Rifle Rounds', weight = 15, stack = true, close = true },
server.cfg
server.cfg
ensure oxmysql
ensure ox_lib
ensure ox_inventory
ensure ox_target
ensure dh_bridge
ensure dh_gunplug
Testing
- Give a test character the gunplug job
- Buy parts and a bench from The Plug
- Place the bench and craft a weapon — it should be a real, firing
WEAPON_*item - Craft the same recipe 5 times; the 6th should be blocked with the cap message
- Run
dh_gunplug_forceresetin the server console to test the weekly reset without waiting for Friday
Troubleshooting
The Plug or bench options don't show — The player's job must match
Config.Job exactly.Crafted weapon is missing or won't fire — The
id in Config.GunPack must exactly match the item name and weapon hash (case matters).Can't reload AKs / Dracos — Add the
ammo-rifle2 item.Bench floats or sinks — Adjust
Config.Table.zOffset and restart the resource.