Replace the existing code block with the following:
RegisterNetEvent('qb-multicharacter:server:createCharacter', function(data)
local src = source
local newData = {}
newData.cid = data.cid
newData.charinfo = data
if QBCore.Player.Login(src, false, newData) then
repeat
Wait(10)
until hasDonePreloading[src]
if GetResourceState('qb-apartments') == 'started' and Apartments.Starting then
local randbucket = (GetPlayerPed(src) .. math.random(1,999))
SetPlayerRoutingBucket(src, randbucket)
print('^2[qb-core]^7 '..GetPlayerName(src)..' has successfully loaded!')
QBCore.Commands.Refresh(src)
loadHouseData(src)
TriggerClientEvent("qb-multicharacter:client:closeNUI", src)
TriggerClientEvent('fry_spawn:client:open_spawn_qbcore_or_qbx', src, true)
GiveStarterItems(src)
else
print('^2[qb-core]^7 '..GetPlayerName(src)..' has successfully loaded!')
QBCore.Commands.Refresh(src)
loadHouseData(src)
TriggerClientEvent("qb-multicharacter:client:closeNUIdefault", src)
GiveStarterItems(src)
end
end
end)
Step 4: You're Ready!
After completing these steps, you're all set to use FRYDEV Spawn with qb-core / qb-multicharacter. Please ensure that you check our "Setup Apartments" GitBook for additional information on how to set up apartments if needed.