Exports and events
Hook your own scripts up to the character and spawn flow.
Client exports
lua
-- Is character selection open?
local open = exports.faustin_multichar:IsOpen()
-- Is the spawn menu open?
local spawnOpen = exports.faustin_multichar:IsSpawnMenuOpen()
-- Open the spawn menu from your own script
exports.faustin_multichar:OpenSpawnMenu({ firstSpawn = false })
-- Your appearance menu has saved, continue to the spawn menu
exports.faustin_multichar:AppearanceDone()| Export | Returns or does |
|---|---|
IsOpen() | Whether character selection is open. |
IsSpawnMenuOpen() | Whether the spawn menu is open. |
OpenSpawnMenu({ firstSpawn = true|false }) | Opens the spawn menu. |
AppearanceDone() | Tells the script that your appearance menu has saved. |
Client events
faustin_multichar:spawned fires after spawning, with the spot id.
lua
AddEventHandler('faustin_multichar:spawned', function(spotId)
print('Arrived at ' .. spotId)
end)The old qb-spawn:client:openUI event opens the spawn menu too, so older scripts keep working.
Framework behaviour
On Qbox the script uses the qbx_core callbacks getCharacters, loadCharacter, createCharacter and deleteCharacter, so all Qbox rules like slot limits, starter items and ownership checks stay in force. On QBCore and ESX the server checks that a character belongs to the player.
Errors
Script errors are caught. The player gets the picture and control back, and the error is printed in the server console.