API
Events and callbacks for Yecoyz Characters, for scripts that need to react to character selection.
Get yecoyz_charactersThese are the events and callbacks Yecoyz Characters sends and answers. Most of them are used by its own UI, but you can use them to react to character changes.
Client events
| Event | Arguments | Description |
|---|---|---|
yecoyz_characters:CharacterSelected |
None | A character has been chosen and loaded. |
yecoyz_characters:OpenCreator |
charId |
Opens the creator for an empty slot. |
yecoyz_characters:OpenSkinMenu |
None | Opens the skin menu for a new character. |
yecoyz_characters:CleanupSelectionScene |
None | Removes the selection scene peds and camera. |
yecoyz_characters:SetupUI |
data |
Sends the character list to the selection UI. |
yecoyz_characters:Notify |
type, message |
Shows a notification. type is info, success, error or warning. |
yecoyz_characters:RequestSpawnMenu |
None | Answers /spawnmenu. Refused when the player is dead or in a vehicle. |
lua
-- client: run something after a character is loaded
AddEventHandler('yecoyz_characters:CharacterSelected', function()
print('Character loaded')
end)Server events
| Event | Arguments | Description |
|---|---|---|
yecoyz_characters:SetupCharacters |
None | The client asks for its character list. |
yecoyz_characters:CharacterChosen |
charId, isNew |
The player picks a slot. isNew is true for an empty slot. |
yecoyz_characters:RegistrationComplete |
data |
Completes the registration of a new character. |
yecoyz_characters:DeleteCharacter |
charId |
Deletes a character. Only works when Config.CanDelete is true. |
yecoyz_characters:Relog |
None | The player uses /spawnmenu. The current character is saved and the selection screen opens again. |
Server callbacks
Call these with Core.Callback from a resource that loads @yecoyz_core/import.lua. See the yecoyz_core callbacks.
| Callback | Arguments | Returns | Description |
|---|---|---|---|
yecoyz_characters:GetCharacterData |
source, charId |
Character table, or nil |
The data of a character in one slot, for the UI. Registered only when ox_lib is running. |
yecoyz_characters:server:GetCharacterSkin |
source |
{ model, skin }, or nil |
The model and skin of the loaded character. QBCore and Qbox only. |
yecoyz_characters:server:GetSkin |
source, citizenid |
model, skin, or nil |
The model and skin of a citizen ID. QBCore and Qbox only. |
lua
-- client
local data = Core.Callback.Await('yecoyz_characters:GetCharacterData', slotId)NoteThe
GetCharacterDatacallback needsox_librunning when Yecoyz Characters starts. If it isn't running, the callback is not registered.