π»FW: QBCore
Tutorial: Implementing FryDev Spawn with qb-core / qb-multicharacter
Step 1: Check Basic Setup
Make sure you've completed our Basic Setup. You can find the details here!
Step 2: Verify Resources
Make sure your fry_spawn
config file is correctly configured in your resource dependencies and its within the [qb] or [whatevercore] folder .
Update it as follows in qb-multicharacter -> fxmanifest.lua
:
dependencies {
'qb-core',
}
Step 3: Modify qb-multicharacter
Now, let's make some changes in qb-multicharacter
to ensure compatibility with FRYDEV Spawn.
In the qb-multicharacter -> server -> main.lua
file, find line 88, which looks like this:
RegisterNetEvent('qb-multicharacter:server:loadUserData', function(cData)
-- Existing code
end)
Replace the existing code block with the following:
RegisterNetEvent('qb-multicharacter:server:loadUserData', function(cData)
local src = source
if QBCore.Player.Login(src, cData.citizenid) then
repeat
Wait(10)
until hasDonePreloading[src]
print('^2[qb-core]^7 '..GetPlayerName(src)..' (Citizen ID: '..cData.citizenid..') has successfully loaded!')
QBCore.Commands.Refresh(src)
loadHouseData(src)
local coords = json.decode(cData.position)
TriggerClientEvent('fry_spawn:client:open_spawn_qbcore_or_qbx', src, false, coords)
TriggerEvent("qb-log:server:CreateLog", "joinleave", "Loaded", "green", "**".. GetPlayerName(src) .. "** (<@"..(QBCore.Functions.GetIdentifier(src, 'discord'):gsub("discord:", "") or "unknown").."> | ||" ..(QBCore.Functions.GetIdentifier(src, 'ip') or 'undefined') .. "|| | " ..(QBCore.Functions.GetIdentifier(src, 'license') or 'undefined') .." | " ..cData.citizenid.." | "..src..") loaded..")
end
end)
Additionally, find the qb-multicharacter -> server -> main.lua
file and locate the following code block:
RegisterNetEvent('qb-multicharacter:server:createCharacter', function(data)
-- Existing code
end)
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.
π¬Setup ApartmentsLast updated
Was this helpful?