JANIEL Resources
  • 🎉Welcome
  • JANIEL-DOCS
    • 🛥️ILLEGAL TUG TRADER
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 🛵FASTFOOD DELIVERY
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 🕊️Spawn Selector
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • ⛽FUELSTATIONS
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 🎣FISHING
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 🔄PROGRESSBAR
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 📢NOTIFY
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 🏨MOTEL MENU
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • ☠️Death Log
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 🏕️Camp Object
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 💸Money Log
      • 🛠️INSTALLATION
      • 📃CONFIGURATION FILE
    • 💃Animation Menu
      • 📃CONFIGURATION FILE
      • 🛠️INSTALLATION
Powered by GitBook
On this page
  • 1. Download resource
  • Usable informations
  • Exports/Events for use in other resources
  1. JANIEL-DOCS
  2. Spawn Selector

INSTALLATION

PreviousSpawn SelectorNextCONFIGURATION FILE

Last updated 2 months ago

1. Download resource

Download the purchased resource from - the official site of fivem with purchased resources.

  1. Adjusting spawn selector to the resources ESX

If you using esx_multicharacter you need change only this, do not change esx_identity

  1. Open @esx_multicharacter/client/main.lua

  2. Search for esx:playerLoaded

  3. Replace the trigger with this one below

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(playerData, isNew, skin)
    local spawn = playerData.coords or Config.Spawn
    if isNew or not skin or #skin == 1 then
        local finished = false
        skin = Config.Default[playerData.sex]
        skin.sex = playerData.sex == "m" and 0 or 1
        local model = skin.sex == 0 and mp_m_freemode_01 or mp_f_freemode_01
        RequestModel(model)
        while not HasModelLoaded(model) do
            RequestModel(model)
            Wait(0)
        end
        SetPlayerModel(PlayerId(), model)
        SetModelAsNoLongerNeeded(model)
        TriggerEvent('skinchanger:loadSkin', skin, function()
            local playerPed = PlayerPedId()
            SetPedAoBlobRendering(playerPed, true)
            ResetEntityAlpha(playerPed)
            TriggerEvent('esx_skin:openSaveableMenu', function()
                finished = true 
            end, function()
                finished = true
            end)
        end)
        repeat Wait(200) until finished
    end
    DoScreenFadeOut(100)
    SetCamActive(cam, false)
    RenderScriptCams(false, false, 0, true, true)
    cam = nil
    local playerPed = PlayerPedId()
    FreezeEntityPosition(playerPed, true)
    exports['janiel_spawn']:OpenSpawnMenu() -- ADDED EXPORT TO OPEN SPAWN SELECTOR
    if not isNew then 
        TriggerEvent('skinchanger:loadSkin', skin or Characters[spawned].skin) 
    end
    Wait(400)
    DoScreenFadeIn(400)
    repeat Wait(200) until not IsScreenFadedOut()
    TriggerServerEvent('esx:onPlayerSpawn')
    TriggerEvent('esx:onPlayerSpawn')
    TriggerEvent('playerSpawned')
    TriggerEvent('esx:restoreLoadout')
    Characters, hidePlayers = {}, false
end)

esx_identity

If you are not using esx_multicharacter but using esx_identity you need change only this

  1. Open @es_extended/client/main.lua

  2. Search for esx:playerLoaded

  3. Add exports['janiel_spawn']:OpenSpawnMenu() as it is below


RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
    ESX.PlayerData = xPlayer
    if not Config.Multichar then
        exports.spawnmanager:spawnPlayer({
            x = ESX.PlayerData.coords.x,
            y = ESX.PlayerData.coords.y,
            z = ESX.PlayerData.coords.z + 0.25,
            heading = ESX.PlayerData.coords.heading,
            model = `mp_m_freemode_01`,
            skipFade = false
        }, function()
            TriggerServerEvent('esx:onPlayerSpawn')
            TriggerEvent('esx:onPlayerSpawn')
            TriggerEvent('esx:restoreLoadout')

            if isNew then
                TriggerEvent('skinchanger:loadDefaultModel', skin.sex == 0)
            elseif skin then
                exports['janiel_spawn']:OpenSpawnMenu() -- ADDED EXPORT TO OPEN SPAWN SELECTOR
                TriggerEvent('skinchanger:loadSkin', skin)
            end

            TriggerEvent('esx:loadingScreenOff')
            ShutdownLoadingScreen()
            ShutdownLoadingScreenNui()
        end)
    end


QB-CORE

qb-multicharacter If you using qb-multicharacter you need change only this

Open @qb-multicharacter/server/main.lua

Search for qb-multicharacter:server:createCharacter

Change from apartments:client:setupSpawnUI for janiel_spawn:open

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 Apartments.Starting then
            local randbucket = (GetPlayerPed(src) .. math.random(1,999))
            SetPlayerRoutingBucket(src, randbucket)
            print('^2[qb-core]^7 '..GetPlayerName(src)..' has succesfully loaded!')
            QBCore.Commands.Refresh(src)
            loadHouseData(src)
            TriggerClientEvent("qb-multicharacter:client:closeNUI", src)
            -- TriggerClientEvent('apartments:client:setupSpawnUI', src, newData)
            TriggerClientEvent('janiel_spawn:open', src)
            GiveStarterItems(src)
        else
            print('^2[qb-core]^7 '..GetPlayerName(src)..' has succesfully loaded!')
            QBCore.Commands.Refresh(src)
            loadHouseData(src)
            TriggerClientEvent("qb-multicharacter:client:closeNUIdefault", src)
            GiveStarterItems(src)
        end
    end
end)
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 succesfully loaded!')
        QBCore.Commands.Refresh(src)
        loadHouseData(src)
        -- TriggerClientEvent('apartments:client:setupSpawnUI', src, cData)
        TriggerClientEvent('janiel_spawn:open', src)
        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)

Usable informations

Exports/Events for use in other resources

Open Spawnselector Menu

Client-side


exports['janiel_spawn']:OpenSpawnMenu(isFirstSpawn)

Server-side


TriggerClientEvent('janiel_spawn:open', source, isFirstSpawn)

🕊️
🛠️
keymaster