Skip to content

project-codex/cx-impound

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A better impound lot for police officers & citizens

STILL IN DEVELOPMENT

Dependencies

Installation

  • Download the ZIP file and extract it in your resources folder
  • Run the SQL file
  • Add ensure cx-impound to your server.cfg

QB-Target installation

Add vehicle interaction to bones in config

Config.TargetBones = {
    ["bones"] = {
        bones = {
            "door_dside_f",
            "door_dside_r",
            "door_pside_f",
            "door_pside_r",
            'boot',
            'rudder',
            'rudder2',
            'petrolcap',
            'petroltank',
            'petroltank_l',
            'petroltank_r',
        },
        options = {
            {
                type = "client",
                event = "qb-target:client:vehicleVehicleOptions",
                icon = "fas fa-sign-in-alt",
                label = "Vehicle options",
            },
        }
    },
}

Add vehicle interactions in config

Config.VehicleInteractions = {
    {
        requiredJob = "police",
        menu = {
            header = "Unimpound Vehicle",
            txt = "Unimpound the impounded vehicle.",
            params = {
                event = "cx-impound:client:buyOutData"
            }
        }
    },
    {
        requiredJob = "police",
        menu = {
            header = "Impound",
            txt = "Impound vehicle.",
            params = {
                isServer = true,
                event = "cx-impound:server:impound",
            }
        }
    },
}

Register vehicle options event in qb-target/client/main.lua

RegisterNetEvent('qb-target:client:vehicleVehicleOptions', function ()
    vehicleOptionsMenu()
end)

Create vehicle options menu function in qb-target/client/main.lua

local function vehicleOptionsMenu()

    local playerData = QBCore.Functions.GetPlayerData()
    local vehicleInteractions = {
        {
            header = "Vehicle Options",
            isMenuHeader = true,
            txt = ""
        }
    }

    for k, v in pairs(Config.VehicleInteractions) do
        if v.requiredJob == playerData.job.name or v.requiredJob == 'all' then
			vehicleInteractions[#vehicleInteractions + 1] = v.menu
        end
    end
    exports['qb-menu']:openMenu(vehicleInteractions)
end