Exports and events
Hook your own scripts up to the character and spawn flow.
Client exports
-- 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. |
Character photos
Every character gets a transparent 512x512 studio photo, shown on the character cards. A new photo is only taken when something the camera can see changes. Other scripts can use the photos too.
| Export | Side | Returns or does |
|---|---|---|
GetPhotoDataURI(src or citizenid) | Server | The photo as a data URI, or nil when there is none yet. |
HasPhoto(src or citizenid) | Server | Whether a photo is stored. |
ForceRecapture(src) | Server | Takes a new photo of an online player. |
CaptureAndReturn(src, timeoutMs) | Server | Takes a new photo and returns it. |
GetPhotoByCitizenId(citizenid) | Client | The photo of any character, also offline ones. |
GetPhotoDataURI(ped) | Client | The photo of a player near you, or your own without a ped. |
Client events
faustin_multichar:spawned fires after spawning, with the spot id.
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.