Step 1: Inventory Items
Navigate to your qb-core/shared/items.lua
file and add the following items to your codebase:
-- CB-GangSystem
heroin_brick = { name = 'heroin_brick', label = 'Heroin Brick', weight = 1000, type = 'item', image = 'heroin_brick.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A brick of Heroin' },
meth_brick = { name = 'meth_brick', label = 'Meth Brick', weight = 1000, type = 'item', image = 'meth_brick.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A brick of Meth' },
-- Blueprint Items
bpcombatpdw = { name = 'bpcombatpdw', label = 'Combat PDW', weight = 1000, type = 'item', image = 'bpcombatpdw.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bpcombatpistol = { name = 'bpcombatpistol', label = 'Combat Pistol', weight = 1000, type = 'item', image = 'bpcombatpistol.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bpmachinepistol = { name = 'bpmachinepistol', label = 'Machine Pistol', weight = 1000, type = 'item', image = 'bpmachinepistol.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bpmicrosmg = { name = 'bpmicrosmg', label = 'Micro SMG', weight = 1000, type = 'item', image = 'bpmicrosmg.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bpminismg = { name = 'bpminismg', label = 'Mini SMG', weight = 1000, type = 'item', image = 'bpminismg.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bppistol = { name = 'bppistol', label = 'Pistol', weight = 1000, type = 'item', image = 'bppistol.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bppistol50 = { name = 'bppistol50', label = 'Pistol 50', weight = 1000, type = 'item', image = 'bppistol50.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bpsnspistol = { name = 'bpsnspistol', label = 'SNS Pistol', weight = 1000, type = 'item', image = 'bpsnspistol.png', unique = true, useable = true, description = 'A piece of paper that describes in detail how to craft a weapon.' },
bpsmallscope_attachment = { name = 'bpsmallscope_attachment', label = 'Small Scope', weight = 1000, type = 'item', image = 'bpsmallscope_attachment.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A piece of paper that describes in detail how to craft a weapon attachment.' },
bpclip_attachment = { name = 'bpclip_attachment', label = 'Extended Clip', weight = 1000, type = 'item', image = 'bpclip_attachment.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A piece of paper that describes in detail how to craft a weapon attachment.' },
bpdrum_attachment = { name = 'bpdrum_attachment', label = 'Drum', weight = 1000, type = 'item', image = 'bpdrum_attachment.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A piece of paper that describes in detail how to craft a weapon attachment.' },
bpflashlight_attachment = { name = 'bpflashlight_attachment', label = 'Flashlight', weight = 1000, type = 'item', image = 'bpflashlight_attachment.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A piece of paper that describes in detail how to craft a weapon attachment.' },
bpsuppressor_attachment = { name = 'bpsuppressor_attachment', label = 'Suppressor', weight = 1000, type = 'item', image = 'bpsuppressor_attachment.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A piece of paper that describes in detail how to craft a weapon attachment.' },
bpgrip_attachment = { name = 'bpgrip_attachment', label = 'Grip', weight = 1000, type = 'item', image = 'bpgrip_attachment.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A piece of paper that describes in detail how to craft a weapon attachment.' },
-- Default QB-Core Items
weed_brick = { name = 'weed_brick', label = 'Weed Brick', weight = 1000, type = 'item', image = 'weed_brick.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A brick of Weed' },
coke_brick = { name = 'coke_brick', label = 'Cocaine Brick', weight = 1000, type = 'item', image = 'coke_brick.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A brick of Cocaine' },
Step 2: Inventory Images
Inventory images are included with the resource. Extract the images from the images
folder and place them in the folder that contains the rest of your inventory images.
Step 3: Database Setup
CREATE TABLE IF NOT EXISTS `gangs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tag` varchar(10) NOT NULL,
`name` varchar(32) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`balance` int(11) NOT NULL DEFAULT 0,
`home_turf` varchar(255) DEFAULT NULL,
`last_blueprint` int(20) DEFAULT 0,
`last_gift` int(20) DEFAULT 0,
`last_home_turf` int(20) DEFAULT 0,
`penalty` int(20) DEFAULT 0,
`last_bm_shop` int(20) DEFAULT 0,
`storage` varchar(50) DEFAULT NULL,
`boss_menu` varchar(50) DEFAULT NULL,
`color` int(11) DEFAULT 0,
`purchased_hints` varchar(255) DEFAULT '[]',
`ranks` varchar(255) DEFAULT ' Prospect, Member, Enforcer, Treasurer, Sergeant at Arms, Vice President, President',
`image` varchar(255) DEFAULT NULL,
`leader_cid` varchar(50) DEFAULT NULL,
`last_active` varchar(50) DEFAULT NULL,
`war` int(20) DEFAULT 0,
`warOutfit` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'NA',
`prevalence` int(11) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `gangs_ui_tag` (`tag`),
UNIQUE KEY `gangs_ui_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `gang_perms` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gang_id` int(11) NOT NULL,
`add_money_perms` varchar(255) DEFAULT '[]',
`remove_money_perms` varchar(255) DEFAULT '[]',
`declare_turf_perms` varchar(255) DEFAULT '[]',
`move_gang_storage` varchar(255) DEFAULT '[]',
`access_storage` varchar(50) DEFAULT '[]',
`add_members` varchar(50) DEFAULT '[]',
`rename_gang` varchar(50) DEFAULT '[]',
`manage_ranks` varchar(50) DEFAULT '[]',
`change_color` varchar(255) DEFAULT '[]',
PRIMARY KEY (`id`),
KEY `gang_id` (`gang_id`),
CONSTRAINT `gang_perms_ibfk_1` FOREIGN KEY (`gang_id`) REFERENCES `gangs` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `gang_rivalries` (
`zone` varchar(255) DEFAULT NULL,
`escrow` int(11) DEFAULT NULL,
`competition` varchar(255) DEFAULT '[]',
`started` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `gang_wars` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`declareeGangID` int(11) NOT NULL,
`declareeGangName` varchar(50) DEFAULT NULL,
`gangID` int(11) NOT NULL,
`gangName` varchar(50) DEFAULT NULL,
`warType` varchar(50) NOT NULL,
`zone` varchar(50) DEFAULT NULL,
`startTime` int(11) NOT NULL,
`endTime` int(11) NOT NULL,
`warStatus` varchar(20) DEFAULT 'Active',
`declareeScore` int(11) DEFAULT 0,
`gangScore` int(11) DEFAULT 0,
`surrenderGang` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE IF NOT EXISTS `gang_zones` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(16) NOT NULL,
`gang_id` int(11) NOT NULL,
`loyalty` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `gang_zones_fk_id` (`gang_id`),
CONSTRAINT `gang_zones_fk_id` FOREIGN KEY (`gang_id`) REFERENCES `gangs` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=925 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
Step 4: QB-Core Edits
Replace the following in your qb-core/config.lua
near Line 53
gang = {
name = 'none',
label = 'No Gang Affiliation',
isboss = false,
grade = {
name = 'none',
level = 0
}
},
Delete the following commands from your qb-core/server/commands.lua
file near Line 273
QBCore.Commands.Add('gang', Lang:t('command.gang.help'), {}, false, function(source)
local PlayerGang = QBCore.Functions.GetPlayer(source).PlayerData.gang
TriggerClientEvent('QBCore:Notify', source, Lang:t('info.gang_info', { value = PlayerGang.label, value2 = PlayerGang.grade.name }))
end, 'user')
QBCore.Commands.Add('setgang', Lang:t('command.setgang.help'), { { name = Lang:t('command.setgang.params.id.name'), help = Lang:t('command.setgang.params.id.help') }, { name = Lang:t('command.setgang.params.gang.name'), help = Lang:t('command.setgang.params.gang.help') }, { name = Lang:t('command.setgang.params.grade.name'), help = Lang:t('command.setgang.params.grade.help') } }, true, function(source, args)
local Player = QBCore.Functions.GetPlayer(tonumber(args[1]))
if Player then
Player.Functions.SetGang(tostring(args[2]), tonumber(args[3]))
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
end
end, 'admin')
Add the following lines to your qb-core/config.lua
near Line 102
gangHideout = 0,
lastBlueprint = 0,
Step 5: Ambulance Job Edits
Replace the following events inside your qb-ambulancejob/client/laststand.lua
file near Line 114
RegisterNetEvent('hospital:client:SetEscortingState', function(bool)
LocalPlayer.state:set('isEscorting', bool, true)
isEscorting = bool
end)
-- Event to update whether the player is being escorted
RegisterNetEvent('hospital:client:SetEscortedState', function(bool)
LocalPlayer.state:set('isEscorted', bool, true)
isEscorted = bool
end)