FRY DEVELOPMENT
TEBEXYOUTUBEDISCORD
  • πŸ“–Welcome
  • Information
    • πŸ”‘Licensing System
    • πŸ“ƒTerms of Service (ToS)
  • πŸ—ΊοΈSPAWN SELECTOR
    • ℹ️Basic Step
    • πŸ”ŒIntegration
      • πŸ’»FW: QBCore
      • πŸ’»FW: QBX
      • 🏬Setup Apartments
      • ☁️Weather Sync
    • βš™οΈConfiguration Settings
      • 🎨UI Customization Guide
      • πŸ› οΈConfig
      • 🌐Translation
      • πŸ–οΈCustomizing Player Spawn-In
    • πŸ› οΈCommon Issues
      • Soon Edit
Powered by GitBook
On this page
  • Step 1: Check Basic Setup
  • Step 2: Verify Resources
  • Step 3: Modify qb-multicharacter
  • Step 4: You're Ready!

Was this helpful?

  1. SPAWN SELECTOR
  2. Integration

FW: QBCore

Tutorial: Implementing FryDev Spawn with qb-core / qb-multicharacter

PreviousIntegrationNextFW: QBX

Last updated 1 year ago

Was this helpful?

Step 1: Check Basic Setup

Make sure you've completed our Basic Setup. You can find the details

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 Apartments
here!