Skip to content

Integrators and Exports

Functions and their uses that will trigger the script from different scripts.

Custom Inventory For House Stash#

If you are using one of the inventories we specified in the script, you can adjust your inventory here.

lua
Config.CustomStash = function(HouseCode, StashNo)
    print(HouseCode) -- Unique House Code (like ID)
    print(StashNo) -- House Stash ID 
end

Adding New House Shells#

https://youtu.be/9umXQ6xbcc8

QB Garage Configure#

In qb-garages script, if you are using Config.SharedGarages = true as true, you need to make this change in qb-garages/server/main.lua file.

Old Code

lua
QBCore.Functions.CreateCallback('qb-garages:server:GetGarageVehicles', function(source, cb, garage, type, category)
    local Player = QBCore.Functions.GetPlayer(source)
    if not Player then return end
    local citizenId = Player.PlayerData.citizenid

    local vehicles

    if type == 'depot' then
        vehicles = MySQL.rawExecute.await('SELECT * FROM player_vehicles WHERE citizenid = ? AND depotprice > 0', { citizenId })
    elseif Config.SharedGarages then
        vehicles = MySQL.rawExecute.await('SELECT * FROM player_vehicles WHERE citizenid = ?', { citizenId })
    else
        vehicles = MySQL.rawExecute.await('SELECT * FROM player_vehicles WHERE citizenid = ? AND garage = ?', { citizenId, garage })
    end

    if #vehicles == 0 then
        cb(nil)
        return
    end
    if Config.ClassSystem then
        local filteredVehicles = filterVehiclesByCategory(vehicles, category)
        cb(filteredVehicles)
    else
        cb(vehicles)
    end
end)

New Code#

lua
QBCore.Functions.CreateCallback('qb-garages:server:GetGarageVehicles', function(source, cb, garage, type, category)
    local Player = QBCore.Functions.GetPlayer(source)
    if not Player then return end
    local citizenId = Player.PlayerData.citizenid

    local vehicles

    if type == 'depot' then
        vehicles = MySQL.rawExecute.await('SELECT * FROM player_vehicles WHERE citizenid = ? AND depotprice > 0', { citizenId })
    elseif Config.SharedGarages then
        vehicles = MySQL.rawExecute.await('SELECT * FROM player_vehicles WHERE citizenid = ?', { citizenId })
    else
        vehicles = MySQL.rawExecute.await('SELECT * FROM player_vehicles WHERE citizenid = ? AND garage = ?', { citizenId, garage })
    end

    for _,data in pairs(vehicles) do
        check = exports["0r_houses"]:IsVehicleInHouseGarage(data.plate)
        if check then
            table.remove(vehicles, _)
        end
    end

    if #vehicles == 0 then
        cb(nil)
        return
    end
    if Config.ClassSystem then
        local filteredVehicles = filterVehiclesByCategory(vehicles, category)
        cb(filteredVehicles)
    else
        cb(vehicles)
    end
end)

Custom Wardrobe#

If you use a different clothing system, you can integrate the wardrobe here.

lua
Config.CustomWardrobe = function()
    -- Client or Server Event
end

Vehicle Spawned Event#

If you use the vehicle key script when the player leaves or enters the garage, you can integrate it here. The example below is for qb-vehiclekeys.

lua
Config.VehicleSpawnAddEvent = function(vehicle, plate)
    -- print(vehicle, plate)
    -- vehicle: vehicle
    -- plate: Vehicle Plate
    -- Usage for plate: plate
    TriggerEvent('vehiclekeys:client:SetOwner', plate)
end

GetPlayerHouses#

If you want to access a player's homes through a different script, you can use this function.

lua
-- Client
local playerHouses = exports["0r_houses"]:GetPlayerHouses()

-- Server
local playerHouses = exports["0r_houses"]:GetPlayerHouses(source)
lua
-- Export playerHouses
{
    [1] = {
        ["HousePrice"] = 5600000,
        ["DiscountValue"] = 1,
        ["Tenant"] = No Tenants,
        ["HouseName"] = Vinewood Loft 3,
    },
}