LogoLogo
  • Codesign Documentation
  • Information
    • Discord Roles
    • FiveM Asset Escrow System
    • Authentication & Transfers
  • Coding Information
    • Register Key Mapping
    • Code Snippets
    • Self Debugging
  • Paid scripts
    • Arm Wrestling
      • Configs, Locales & SQL
    • Car HUD
      • Configs, Locales & SQL
    • CCTV Cameras
      • Configs, Locales & SQL
    • Darts
      • Configs, Locales & SQL
    • Dispatch
      • Configs, Locales & SQL
      • Resource Integration
    • Door Lock
      • Configs, Locales & SQL
    • Garage
      • Keys/Chat/Events/Exports
      • Optional Features
      • Configs, Locales & SQL
      • Resource Integration
    • Gun Range
      • Configs, Locales & SQL
    • Identity
      • Configs, Locales & SQL
    • Multicharacter
      • Configs, Locales & SQL
    • Player HUD
      • Configs, Locales & SQL
    • Props
      • Configs, Locales & SQL
    • Radar
      • Configs, Locales & SQL
    • Spawn Select
      • Configs, Locales & SQL
    • Terminal Hacker
      • Configs, Locales & SQL
    • Vehicle Control
      • Configs, Locales & SQL
    • VIP Shop
      • Configs, Locales & SQL
  • Free Scripts
    • Easytime
      • Keys/Chat/Events/Exports
      • Optional Features
      • Configs & Locales
    • Drawtext UI
    • Devtools
    • Keymaster - Minigame
    • Staff Support
    • Notifications
Powered by GitBook
LogoLogo

Codesign Software © All rights reserved

On this page
  • Compatible Resources
  • ESX Resources
  • Keys
  • Job Garages
  • Boat & Air Garages
  • Persistent Vehicle
  • QBCore Resources
  • Keys
  • Boat & Air Garages
  • Persistent Vehicle
  • Garage Phone Apps
  • Paid Resources
  • Keys
  • Boat & Air Garages
  • Garage Phone Apps

Was this helpful?

  1. Paid scripts
  2. Garage

Resource Integration

This guide helps customers understand how to integrate cd_garage with other resources for seamless functionality.

PreviousConfigs, Locales & SQLNextGun Range

Last updated 7 months ago

Was this helpful?

Compatible Resources

Compatibility Type

There are multiple ways another resource can be considered compatible with cd_garage. Some methods are easier for customers than others

Built-in (Recommended): This means the resource's creator has already made the necessary changes to ensure compatibility with cd_garage, so you don’t have to do anything.

Creator Docs: This indicates that the creator provides documentation outlining the required changes you need to make for their resource to be compatible with cd_garage.

Resource Name
Compatibility Type

lb-phone

Built-in

okok-vehicleshop

Creator Docs

gksphone

Built-in

cdev-vehcleshop

Built-in

ESX Resources

Keys

To use our built-in vehicle keys feature with official ESX resources, only the following modifications are required. This is necessary because most ESX resources typically call these functions to spawn vehicles.

Still don't recieve keys? If you don't receive keys to a vehicle, most likely, one of your resources does not use any of the ESX spawn vehicle functions, so you will need to refer to and add the event to that resource.

Add the 2 line's of code exactly as seen in the screenshot below.
Wait(100)
TriggerClientEvent('cd_garage:AddKeys', xPlayer.id, GetVehicleNumberPlateText(createdVehicle))

Add the line of code exactly as seen in the screenshot below.
TriggerEvent('cd_garage:AddKeys', exports['cd_garage']:GetPlate(vehicle))

Job Garages

To utilize our built-in job garage feature with official ESX resources, only the following modifications are required:

REPLACE the line of code exactly as seen in the screenshot below.
MySQL.insert('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job_personalowned, `stored`) VALUES (?, ?, ?, ?, ?, ?)', { xPlayer.identifier, json.encode(vehicleProps), vehicleProps.plate, type, xPlayer.job.name, true},

REPLACE the line of code exactly as seen in the screenshot below.
MySQL.insert('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (?, ?, ?, ?, ?, ?)', { xPlayer.job.name, json.encode(vehicleProps), vehicleProps.plate, type, xPlayer.job.name, true},

Boat & Air Garages

To use our built-in boat and air garages feature with official ESX resources, only the following modifications are required:

Add the line of code exactly as seen in the screenshot below.
TriggerEvent('cd_garage:UpdateGarageType')

Persistent Vehicle

To use our built-in persistent vehicle feature with official ESX resources, only the following modifications are required:

Add the line of code exactly as seen in the screenshot below.
TriggerServerEvent('cd_garage:RemovePersistentVehicles', exports['cd_garage']:GetPlate(vehicle))

QBCore Resources

Keys

To use our built-in vehicle keys feature with official QBCore resources, only the following modifications are required.

This process is much simpler on QBCore compared to ESX, as we have integrated event handlers for the default QBCore qb-vehiclekeys resource into cd_garage, meaning it’s mostly pre-configured.

REPLACE the line’s of code exactly as seen in the screenshot below.
if GetResourceState('cd_garage') == 'started' and plate then
    hasKeys = exports['cd_garage']:DoesPlayerHaveKeys(plate)
end

Boat & Air Garages

To use our built-in boat and air garages feature with official QBCore resources, only the following modifications are required:

Add the line of code exactly as seen in the screenshot below.
TriggerEvent('cd_garage:UpdateGarageType')

Persistent Vehicle

To use our built-in persistent vehicle feature with official QBCore resources, only the following modifications are required:

Add the line of code exactly as seen in the screenshot below.
TriggerServerEvent('cd_garage:RemovePersistentVehicles', exports['cd_garage']:GetPlate(vehicle))

Garage Phone Apps

To make your phone's garage app compatible with cd_garage, only the following modifications are required. If you use a phone not listed below, these changes may not work for you.

Replace this whole function.
QBCore.Functions.CreateCallback('qb-phone:server:GetPhoneData', function(source, cb)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if Player ~= nil then
        local PhoneData = {
            Applications = {},
            PlayerContacts = {},
            MentionedTweets = {},
            Chats = {},
            Hashtags = {},
            Invoices = {},
            Garage = {},
            Mails = {},
            Adverts = {},
            CryptoTransactions = {},
            Tweets = {},
            Images = {},
            InstalledApps = Player.PlayerData.metadata["phonedata"].InstalledApps
        }
        PhoneData.Adverts = Adverts

        local result = MySQL.query.await('SELECT * FROM player_contacts WHERE citizenid = ? ORDER BY name ASC', {Player.PlayerData.citizenid})
        if result[1] ~= nil then
            for _, v in pairs(result) do
                v.status = GetOnlineStatus(v.number)
            end

            PhoneData.PlayerContacts = result
        end

        local invoices = MySQL.query.await('SELECT * FROM phone_invoices WHERE citizenid = ?', {Player.PlayerData.citizenid})
        if invoices[1] ~= nil then
            for _, v in pairs(invoices) do
                local Ply = QBCore.Functions.GetPlayerByCitizenId(v.sender)
                if Ply ~= nil then
                    v.number = Ply.PlayerData.charinfo.phone
                else
                    local res = MySQL.query.await('SELECT * FROM players WHERE citizenid = ?', {v.sender})
                    if res[1] ~= nil then
                        res[1].charinfo = json.decode(res[1].charinfo)
                        v.number = res[1].charinfo.phone
                    else
                        v.number = nil
                    end
                end
            end
            PhoneData.Invoices = invoices
        end

        local garageresult = MySQL.query.await('SELECT * FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid})
        if garageresult[1] ~= nil then
            for _, v in pairs(garageresult) do
                local vehicleModel = v.vehicle
                if QBCore.Shared.Vehicles[vehicleModel] then
                    v.garage = v.garage_id
                    v.vehicle = QBCore.Shared.Vehicles[vehicleModel].name
                    v.brand = QBCore.Shared.Vehicles[vehicleModel].brand
                end

            end
            PhoneData.Garage = garageresult
        end

        local messages = MySQL.query.await('SELECT * FROM phone_messages WHERE citizenid = ?', {Player.PlayerData.citizenid})
        if messages ~= nil and next(messages) ~= nil then
            PhoneData.Chats = messages
        end

        if AppAlerts[Player.PlayerData.citizenid] ~= nil then
            PhoneData.Applications = AppAlerts[Player.PlayerData.citizenid]
        end

        if MentionedTweets[Player.PlayerData.citizenid] ~= nil then
            PhoneData.MentionedTweets = MentionedTweets[Player.PlayerData.citizenid]
        end

        if Hashtags ~= nil and next(Hashtags) ~= nil then
            PhoneData.Hashtags = Hashtags
        end

        local Tweets = MySQL.query.await('SELECT * FROM phone_tweets WHERE `date` > NOW() - INTERVAL ? hour', {Config.TweetDuration})

        if Tweets ~= nil and next(Tweets) ~= nil then
            PhoneData.Tweets = Tweets
            TWData = Tweets
        end

        local mails = MySQL.query.await('SELECT * FROM player_mails WHERE citizenid = ? ORDER BY `date` ASC', {Player.PlayerData.citizenid})
        if mails[1] ~= nil then
            for k, _ in pairs(mails) do
                if mails[k].button ~= nil then
                    mails[k].button = json.decode(mails[k].button)
                end
            end
            PhoneData.Mails = mails
        end

        local transactions = MySQL.query.await('SELECT * FROM crypto_transactions WHERE citizenid = ? ORDER BY `date` ASC', {Player.PlayerData.citizenid})
        if transactions[1] ~= nil then
            for _, v in pairs(transactions) do
                PhoneData.CryptoTransactions[#PhoneData.CryptoTransactions+1] = {
                    TransactionTitle = v.title,
                    TransactionMessage = v.message
                }
            end
        end
        local images = MySQL.query.await('SELECT * FROM phone_gallery WHERE citizenid = ? ORDER BY `date` DESC',{Player.PlayerData.citizenid})
        if images ~= nil and next(images) ~= nil then
            PhoneData.Images = images
        end
        cb(PhoneData)
    end
end)

Replace this whole function.
QBCore.Functions.CreateCallback('qb-phone:server:GetGarageVehicles', function(source, cb)
    local Player = QBCore.Functions.GetPlayer(source)
    local Vehicles = {}
    local vehdata
    local result = exports.oxmysql:executeSync('SELECT * FROM player_vehicles WHERE citizenid = ?', {Player.PlayerData.citizenid})
    if result[1] then
        for _, v in pairs(result) do
            local VehicleData = QBCore.Shared.Vehicles[v.vehicle]
            local VehicleGarage = "None"
            local enginePercent = round(v.engine / 10, 0)
            local bodyPercent = round(v.body / 10, 0)
            VehicleGarage = v.garage_id

            local VehicleState = "In"
            if v.in_garage ~= true then
                VehicleState = "Out"
            end
            if v.impound ~= 0 then
                VehicleState = "Impounded"
            end

            if VehicleData["brand"] then
                vehdata = {
                    fullname = VehicleData["brand"] .. " " .. VehicleData["name"],
                    brand = VehicleData["brand"],
                    model = VehicleData["name"],
                    plate = v.plate,
                    garage = VehicleGarage,
                    state = VehicleState,
                    fuel = v.fuel,
                    engine = enginePercent,
                    body = bodyPercent,
                    paymentsleft = v.paymentsleft
                }
            else
                vehdata = {
                    fullname = VehicleData["name"],
                    brand = VehicleData["name"],
                    model = VehicleData["name"],
                    plate = v.plate,
                    garage = VehicleGarage,
                    state = VehicleState,
                    fuel = v.fuel,
                    engine = enginePercent,
                    body = bodyPercent,
                    paymentsleft = v.paymentsleft
                }
            end
            Vehicles[#Vehicles+1] = vehdata
        end
        cb(Vehicles)
    else
        cb(nil)
    end
end)

Paid Resources

Keys

You can find this event in [okok-vehicleshop/sv_utils.lua] (approx; line 72).

Add the line of code exactly as seen in the screenshot below.
TriggerClientEvent('cd_garage:AddKeys', _source, vehicleProps.plate:match( "^%s*(.-)%s*$" ))

Boat & Air Garages

You can find this event in [okok-vehicleshop/sv_utils.lua] (approx; line 68).

Add the line of code exactly as seen in the screenshot below.
TriggerClientEvent('cd_garage:UpdateGarageType', source)

Garage Phone Apps

To make your phone's garage app compatible with cd_garage, only the following modifications are required. If you use a phone not listed below, these changes may not work for you.

lb-phone comes pre-configured to work with cd_garage, so no modifications are required.

gksphone comes pre-configured to work with cd_garage, so no modifications are required.

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

Vehicles Still Respawn After Deletion? If vehicles still respawn after being deleted, it’s likely that one of your resources does not use the ESX delete vehicle function. You will need to refer to and add the necessary event to that resource.

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

Vehicles still respawn when deleting them? If vehicles still respawn when deleting them, most likely, one of your resources does not use the QBCore delete vehicle function, so you will need to refer to and add the event to that resource.

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

Click this link to view the code on GitHub:

#VehicleKeys
ex_extended/server/onesync.lua
ex_extended/client/functions.lua
esx_policejob/server/main.lua
esx_policejob/server/main.lua
esx_boat/client/main.lua
#PersistentVehicles
es_extended/client/functions.lua
qb-core/client/events.lua
qb-vehicleshop/client/main.lua
#P
ersistentVehicles
qb-core/client/functions.lua
qb-phone/server/main.lua
qb-phone/server/garage.lua