⚙️Integration
Item creation
If you don't want to use the command, you can use a tablet item instead.
Add the following lines to to qb-core/shared/items.lua
['choptablet'] = { ['name'] = 'choptablet', ['label'] = 'Chop tablet', ['weight'] = 1000, ['type'] = 'item', ['image'] = 'choptablet.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = "There is an app on that."},
weapon_hackingdevice = { name = 'weapon_hackingdevice', label = 'Hacking Device', weight = 1000, type = 'weapon', ammotype = nil, image = 'hackingdevice.png', unique = true, useable = false, description = 'A device to hack' },
weapon_digiscanner = { name = 'weapon_digiscanner', label = 'Scanning Device', weight = 1000, type = 'weapon', ammotype = nil, image = 'digiscanner.png', unique = true, useable = false, description = 'You scan with this' },
Add the image file to qb-inventory/html/images/choptablet.png

Add the image file to qb-inventory/html/images/hackingdevice.png

Add the image file to qb-inventory/html/images/digiscanner.png

Add the following code to the end of public\api\sv_inventory.lua
CreateThread(function()
QBCore.Functions.CreateUseableItem("choptablet", function(source, item)
TriggerClientEvent("kub_chop:client:openTablet", source)
end)
end)Add this section to ox_inventory/data/items.lua
['choptablet'] = {
label = 'Chop tablet',
weight = 0,
description = "There is an app on that",
client = {
export = 'kub_chop.choptabletopen',
}
},Add this section to ox_inventory/data/weapons.lua
['WEAPON_HACKINGDEVICE'] = {
label = 'Hacking device',
weight = 500,
},
['WEAPON_DIGISCANNER'] = {
label = 'Scanner',
weight = 500,
},Add the image file to ox_inventory/web/images/choptablet.png

Add the image file to ox_inventory/web/images/hackingdevice.png

Add the image file to ox_inventory/web/images/digiscanner.png

Create the item in your inventory system. Trigger the following client-side event:
Event kub_chop:client:openTablet on tablet item use.
Export kub_chop.choptabletopen
After you have successfully added the item you can disable the command by setting commandsEnabled to false in public\config\client\cl_config.lua
commandsEnabled = false,Police dispatch calls
If you wish police to receive dispatch calls / notifications when contracts with gate hacking are being done.
In public\api\cl_framework.lua, change the alertPolice function to this
function alertPolice(vehicleNetId, activeContract, type)
if type == 'gateHackFinished' then
local coords = vector3(activeContract.contract.vehicle_location.x, activeContract.contract.vehicle_location.y, activeContract.contract.vehicle_location.z)
local vehicle = NetworkGetEntityFromNetworkId(vehicleNetId)
local vehicleClass = activeContract.contract.vehicle_class
exports["ps-dispatch"]:CustomAlert({
coords = coords,
message = "Vehicle is being stolen",
dispatchCode = "10-35A",
description = 'Vehicle stolen',
radius = 0,
plate = ('%s (%s class)'):format(GetVehicleNumberPlateText(vehicle), vehicleClass),
sprite = 523,
color = 5,
scale = 1.5,
length = 3,
})
return
end
endIn public\api\cl_framework.lua, change the alertPolice function to this
function alertPolice(vehicleNetId, activeContract, type)
if type == 'gateHackFinished' then
local coords = vector3(activeContract.contract.vehicle_location.x, activeContract.contract.vehicle_location.y, activeContract.contract.vehicle_location.z)
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = { 'police', },
coords = coords,
title = '10-35A',
message = "Vehicle is being stolen",
flash = 0,
unique_id = tostring(math.random(0000000, 9999999)),
sound = 1,
blip = {
sprite = 431,
scale = 1.2,
colour = 3,
flashes = false,
text = '911 - Vehicle stolen',
time = 5,
radius = 0,
}
})
return
end
endIn public\api\cl_framework.lua, change the alertPolice function. The code you add should send a dispatch call to your online police members.
Last updated