MrNewbScripts
My DiscordSee The StoreCommunity_BridgeGithub
  • MOTD
  • MrNewbVehicleKeys
    • Install
      • Framework
        • esx
        • qb-core
        • qbox
      • inventory
        • 🐂ox_inventory
        • qb-inventory
        • qb-inventoryv2
        • origen_inventory
        • ps-inventory
        • jpr-inventory
        • qs-inventory
      • Inventory Images
    • Exports
      • Server Exports
      • Client Exports
    • Backwards Events
      • Client Events
      • Server Events
    • FAQ
    • Commands
    • Snippet Examples
      • qb-vehicleshop
      • qb-garages
      • Common qb-core Snippets
  • MrNewbBeeKeeping
    • Install
      • Frameworks
        • qb-core
        • qbox
        • ESX
      • Inventory Images
      • Inventory
        • 🐂ox_inventory
  • MrNewbPrescriptions
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • 🐂ox inventory
        • qs-inventory
        • qb-inventory V1
        • qb-inventory v2
      • Inventory Images
    • Exports
      • Server Exports
      • Client Exports
    • Snippet Examples
      • qb-drugs
      • qbx_ambulancejob
    • FAQ
  • MrNewbPlateCarriers
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • 🐂ox_inventory
        • qb-inventoryv2
      • Inventory Images
    • Exports
      • Server Exports
  • MrNewbCustomPlates
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • ox_inventory Steps
      • Inventory Images
  • MrNewbNameChanger
    • Install
      • Frameworks
        • qb-core
        • qbox
        • ESX
      • Inventory
        • 🐂ox_inventory
        • ps-inventory
        • qb-inventoryv2
        • qb-inventory
      • Inventory Images
  • MrNewbPawn
    • Install
  • MrNewbPhoneTracker
    • Install
      • Frameworks
        • qb-core
        • qbox
        • ESX
      • Inventory Images
      • Inventory
        • 🐂ox_inventory
  • MrNewbWeaponTints
    • Install
      • inventory
        • ox_inventory Steps
      • Inventory Images
  • MrNewbGiftBox
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • ox_inventory Steps
      • Inventory Images
    • Exports
      • Server Exports
Powered by GitBook
On this page
  1. MrNewbVehicleKeys
  2. Install
  3. Framework

qb-core

To install MrNewbVehicleKeys to the core you will need use this snippet

Step #1 adding RemoveKeys for /dv, find the below in qb-core/client/events.lua
-- Find This in qb-core/client/events.lua aprox around line 144
RegisterNetEvent('QBCore:Command:DeleteVehicle', function()
    local ped = PlayerPedId()
    local veh = GetVehiclePedIsUsing(ped)
    if veh ~= 0 then
        SetEntityAsMissionEntity(veh, true, true)
        DeleteVehicle(veh)
    else
        local pcoords = GetEntityCoords(ped)
        local vehicles = GetGamePool('CVehicle')
        for _, v in pairs(vehicles) do
            if #(pcoords - GetEntityCoords(v)) <= 5.0 then
                SetEntityAsMissionEntity(v, true, true)
                DeleteVehicle(v)
            end
        end
    end
end)
-- Paste this in in its place
-- Paste this in in its place
RegisterNetEvent('QBCore:Command:DeleteVehicle', function()
    local ped = PlayerPedId()
    local veh = GetVehiclePedIsUsing(ped)
    if veh ~= 0 then
        exports.MrNewbVehicleKeys:RemoveKeys(veh)
        SetEntityAsMissionEntity(veh, true, true)
        DeleteVehicle(veh)
    else
        local pcoords = GetEntityCoords(ped)
        local vehicles = GetGamePool('CVehicle')
        for _, v in pairs(vehicles) do
            if #(pcoords - GetEntityCoords(v)) <= 5.0 then
                exports.MrNewbVehicleKeys:RemoveKeys(v)
                SetEntityAsMissionEntity(v, true, true)
                DeleteVehicle(v)
            end
        end
    end
end)

Step #2 Go to qb-core/shared/items.lua and paste this in, depending on the qb
version you use I have added both qbs old and new formats
['vehiclekeys'] 		= {['name'] = 'vehiclekeys', 			['label'] = 'Vehicle Keys', 			['weight'] = 100, ['type'] = 'item', ['image'] = 'vehiclekeys.png', 		['unique'] = true, 	['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Fancy vehicle keys'},
['keyring'] 			= {['name'] = 'keyring', 			['label'] = 'Keyring', 				['weight'] = 220, ['type'] = 'item', ['image'] = 'keyring.png', 		['unique'] = false,     ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A keyring that holds car keys.'},
['aftermarket_locks'] 	        = {['name'] = 'aftermarket_locks', 		['label'] = 'Aftermarket Lock System',          ['weight'] = 220, ['type'] = 'item', ['image'] = 'aftermarket_locks.png', 	['unique'] = false,     ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A Vehicle Lock System To Replace Key Systems'},
['lockpick'] 			= {['name'] = 'lockpick', 			['label'] = 'Lockpick', 		 	['weight'] = 850, ['type'] = 'item', ['image'] = 'lockpick.png', 		['unique'] = false,     ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A mysterious device.'},
['advancedlockpick'] 	        = {['name'] = 'advancedlockpick', 		['label'] = 'Advanced Lockpick', 		['weight'] = 850, ['type'] = 'item', ['image'] = 'advancedlockpick.png', 	['unique'] = false,     ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A upgraded mysterious device.'},


vehiclekeys                  = { name = 'vehiclekeys',              label = 'Vehicle Keys',             weight = 100, type = 'item', image = 'vehiclekeys.png',         unique = true,     useable = true, shouldClose = true, combinable = nil, description = 'Fancy vehicle keys' },
keyring                      = { name = 'keyring',                  label = 'Vehicle Key Ring',         weight = 100, type = 'item', image = 'keyring.png',             unique = true,     useable = true, shouldClose = true, combinable = nil, description = 'A keyring to solve all problems.' },
aftermarket_locks            = { name = 'aftermarket_locks',        label = 'Aftermarket Lock System',  weight = 100, type = 'item', image = 'aftermarket_locks.png',   unique = true,     useable = true, shouldClose = true, combinable = nil, description = 'A Vehicle Lock System To Replace Key Systems' },
lockpick                     = { name = 'lockpick',                 label = 'Lockpick',                 weight = 300, type = 'item', image = 'lockpick.png',            unique = false,    useable = true, shouldClose = true, combinable = nil, description = 'A mysterious device.' },
advancedlockpick             = { name = 'advancedlockpick',         label = 'Advanced Lockpick',        weight = 500, type = 'item', image = 'advancedlockpick.png',    unique = false,    useable = true, shouldClose = true, combinable = nil, description = 'A upgraded mysterious device.' },

Please note, if you are using an alternative admin menu that registers the command /car you will need to add my exports there as well. Default qb-vehiclekeys events should all work as of now.

PreviousesxNextqbox

Last updated 14 days ago