Installation
1. Download resource
Download the purchased resource from keymaster - the official site of fivem with purchased resources.
2. Adjusting spawn selector to the resources
esx_multicharacter
If you using esx_multicharacter you need change only this, do not change esx_identity
Open @esx_multicharacter/client/main.lua
Search for
esx:playerLoaded
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['vms_spawnselector']:OpenSpawnSelector() -- 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
Open @es_extended/client/main.lua
Search for
esx:playerLoaded
Add
exports['vms_spawnselector']:OpenSpawnSelector()
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['vms_spawnselector']:OpenSpawnSelector() -- ADDED EXPORT TO OPEN SPAWN SELECTOR
TriggerEvent('skinchanger:loadSkin', skin)
end
TriggerEvent('esx:loadingScreenOff')
ShutdownLoadingScreen()
ShutdownLoadingScreenNui()
end)
end
[...]
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
forvms_spawnselector: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('vms_spawnselector: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('vms_spawnselector: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)
Last updated