QB Spawn setting
-- Search this
RegisterNUICallback('spawnplayer', function(data, cb)
Find if type == "current"
and follow the method below
if type == "current" then
PreSpawnPlayer()
QBCore.Functions.GetPlayerData(function(pd)
ped = PlayerPedId()
SetEntityCoords(ped, pd.position.x, pd.position.y, pd.position.z)
SetEntityHeading(ped, pd.position.a)
FreezeEntityPosition(ped, false)
end)
if insideMeta.house ~= nil then
local houseId = insideMeta.house
TriggerEvent('qb-houses:client:LastLocationHouse', houseId)
elseif insideMeta.apartment.apartmentType ~= nil or insideMeta.apartment.apartmentId ~= nil then
local apartmentType = insideMeta.apartment.apartmentType
local apartmentId = insideMeta.apartment.apartmentId
TriggerEvent('qb-apartments:client:LastLocationHouse', apartmentType, apartmentId)
end
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
TriggerEvent('QBCore:Client:OnPlayerLoaded')
PostSpawnPlayer()
Replace with
if type == "current" then
PreSpawnPlayer()
QBCore.Functions.GetPlayerData(function(pd)
ped = PlayerPedId()
SetEntityCoords(ped, pd.position.x, pd.position.y, pd.position.z)
SetEntityHeading(ped, pd.position.a)
FreezeEntityPosition(ped, false)
end)
if insideMeta.house ~= nil then
local houseId = insideMeta.house
TriggerEvent('qb-houses:client:LastLocationHouse', houseId)
elseif insideMeta.apartment.apartmentType ~= nil or insideMeta.apartment.apartmentId ~= nil then
local apartmentType = insideMeta.apartment.apartmentType
local apartmentId = insideMeta.apartment.apartmentId
TriggerEvent('qb-apartments:client:LastLocationHouse', apartmentType, apartmentId)
elseif insideMeta.motel ~= nil and insideMeta.motel.motel ~= nil and insideMeta.motel.room ~= nil then
local motel = insideMeta.motel.motel
local room = insideMeta.motel.room
TriggerEvent('jl-motel:client:spawnLastLocation', motel, room)
end
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
TriggerEvent('QBCore:Client:OnPlayerLoaded')
PostSpawnPlayer()