Installation
1. Download and Unzip the bit-spawn.pack.zip and
place this folder in your server's resource folder.
2. Add the resources to your server start config after your multi-character script:
ensure qb-multicharacter
ensure bit-spawn
4.Restart your server.
WARNING do not edit the encrypted files in any way.
QB Installation
Open qb-multicharacter > server > main.lua Change the qb-multicharacter:server:loadUserData to this:
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)
if Config.SkipSelection then
local coords = json.decode(cData.position)
TriggerClientEvent('qb-multicharacter:client:spawnLastLocation', src, coords, cData)
else
TriggerClientEvent('bit-spawn:openSelector', src)
end
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)
ESX Installation
Open esx_multicharacter > client > main.lua In the esx:playerLoaded event, at the end of it, modify these lines:
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
TriggerEvent('playerSpawned')
TriggerEvent('esx:restoreLoadout')
Characters, hidePlayers = {}, false
and add the trigger to open the bit-spawn:
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
TriggerEvent('playerSpawned')
TriggerEvent('esx:restoreLoadout')
TriggerEvent('bit-spawn:openSelector') -- BIT SPAWN
Characters, hidePlayers = {}, false
QBOX Installation
Open qbx_core > client > character.lua Change the entire chooseCharacter function:
local function chooseCharacter()
---@type PlayerEntity[], integer
local characters, amount = lib.callback.await('qbx_core:server:getCharacters')
local firstCharacterCitizenId = characters[1] and characters[1].citizenid
previewPed(firstCharacterCitizenId)
randomLocation = config.characters.locations[math.random(1, #config.characters.locations)]
SetFollowPedCamViewMode(2)
DisplayRadar(false)
DoScreenFadeOut(500)
while not IsScreenFadedOut() and cache.ped ~= PlayerPedId() do
Wait(0)
end
FreezeEntityPosition(cache.ped, true)
Wait(1000)
SetEntityCoords(cache.ped, randomLocation.pedCoords.x, randomLocation.pedCoords.y, randomLocation.pedCoords.z, false, false, false, false)
SetEntityHeading(cache.ped, randomLocation.pedCoords.w)
NetworkStartSoloTutorialSession()
while not NetworkIsInTutorialSession() do
Wait(0)
end
Wait(1500)
ShutdownLoadingScreen()
ShutdownLoadingScreenNui()
setupPreviewCam()
local options = {}
for i = 1, amount do
local character = characters[i]
local name = character and ('%s %s'):format(character.charinfo.firstname, character.charinfo.lastname)
options[i] = {
title = character and ('%s %s - %s'):format(character.charinfo.firstname, character.charinfo.lastname, character.citizenid) or locale('info.multichar_new_character', i),
metadata = character and {
Name = name,
Gender = character.charinfo.gender == 0 and locale('info.char_male') or locale('info.char_female'),
Birthdate = character.charinfo.birthdate,
Nationality = character.charinfo.nationality,
['Account Number'] = character.charinfo.account,
Bank = lib.math.groupdigits(character.money.bank),
Cash = lib.math.groupdigits(character.money.cash),
Job = character.job.label,
['Job Grade'] = character.job.grade.name,
Gang = character.gang.label,
['Gang Grade'] = character.gang.grade.name,
['Phone Number'] = character.charinfo.phone
} or nil,
icon = 'user',
onSelect = function()
if character then
lib.showContext('qbx_core_multichar_character_'..i)
previewPed(character.citizenid)
else
local success = createCharacter(i)
if success then return end
previewPed(firstCharacterCitizenId)
lib.showContext('qbx_core_multichar_characters')
end
end
}
if character then
lib.registerContext({
id = 'qbx_core_multichar_character_'..i,
title = ('%s %s - %s'):format(character.charinfo.firstname, character.charinfo.lastname, character.citizenid),
canClose = false,
menu = 'qbx_core_multichar_characters',
options = {
{
title = locale('info.play'),
description = locale('info.play_description', name),
icon = 'play',
onSelect = function()
DoScreenFadeOut(10)
lib.callback.await('qbx_core:server:loadCharacter', false, character.citizenid)
if GetResourceState('qbx_apartments'):find('start') then
TriggerEvent('apartments:client:setupSpawnUI', character.citizenid)
elseif GetResourceState('qbx_spawn'):find('start') then
TriggerEvent('bit-spawn:openSelector', character.citizenid) -- BIT SPAWN
else
spawnLastLocation()
end
destroyPreviewCam()
end
},
config.characters.enableDeleteButton and {
title = locale('info.delete_character'),
description = locale('info.delete_character_description', name),
icon = 'trash',
onSelect = function()
local alert = lib.alertDialog({
header = locale('info.delete_character'),
content = locale('info.confirm_delete'),
centered = true,
cancel = true
})
if alert == 'confirm' then
TriggerServerEvent('qbx_core:server:deleteCharacter', character.citizenid)
destroyPreviewCam()
chooseCharacter()
else
lib.showContext('qbx_core_multichar_character_'..i)
end
end
} or nil
}
})
end
end
lib.registerContext({
id = 'qbx_core_multichar_characters',
title = locale('info.multichar_title'),
canClose = false,
options = options
})
SetTimecycleModifier('default')
lib.showContext('qbx_core_multichar_characters')
end
Last updated