qb-spawn
Integration for housing for qb-spawn
Client​
Comment this part
-- RegisterNetEvent('qb-houses:client:setHouseConfig', function(houseConfig)
-- Houses = houseConfig
-- end)
Find: qb-spawn:server:getOwnedHouses
local myHouses = {}
if houses ~= nil then
for i = 1, (#houses), 1 do
myHouses[#myHouses+1] = {
house = houses[i].house,
label = Houses[houses[i].house].adress,
}
end
end
Replace:
local myHouses = {}
if houses ~= nil then
for i = 1, (#houses), 1 do
Houses[houses[i].identifier] = houses[i]
myHouses[#myHouses+1] = {
house = houses[i].identifier,
label = houses[i].name,
}
end
end
Find: RegisterNUICallback('setCam', function(data,cb)
elseif type == "house" then
SetCam(Houses[location].coords.enter)
Replace:
elseif type == "house" then
SetCam(Houses[location].entry)
Find:
TriggerEvent('qb-houses:client:enterOwnedHouse', location)
Replace:
if Houses[location].type ~= 'mlo' then
TriggerEvent('Housing:server:EnterHome', location)
else
SetEntityCoords(ped, Houses[location].entry.x, Houses[location].entry.y, Houses[location].entry.z)
end
Server​
qb-spawn/server.lua
QBCore.Functions.CreateCallback('qb-spawn:server:getOwnedHouses', function(_, cb, cid)
if cid ~= nil then
local houses = exports['bcs_housing']:GetOwnedHomes(cid)
if houses[1] ~= nil then
cb(houses)
else
cb({})
end
else
cb({})
end
end)
index.html​
Replace
qb-spawn/html/index.html
click_location: function(type, name) {
if (type == "normal") {
axios.post('https://qb-spawn/setCam', {
posname: name,
type: type,
});
}
this.selectedValue = {type: type, name: name}
},
With
qb-spawn/html/index.html
click_location: function(type, name) {
if (type == "normal" || type == "house") {
axios.post('https://qb-spawn/setCam', {
posname: name,
type: type,
});
}
this.selectedValue = {type: type, name: name}
},