onCharacterCreated
Registers a callback that runs when a player finishes the character creator. The creator is a separate UI from the clothing shop, so it has its own hook. onShopClosed does not fire when the creator is saved.
It fires however the creator was opened: through your multicharacter (InitializeCharacter), startPlayerCustomization or openCharacterCreator. Unlike those callbacks, which belong to whoever opened the creator, any number of resources can listen here.
๐ก Syntax
exports['kartik-clothing']:onCharacterCreated(function(appearance) end)๐ฅ Parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
cb | function | No | Called with the saved appearance table once the character is created. |
๐ค Returns
| Type | Description |
|---|---|
boolean | true if the callback was registered. |
Callbacks are removed automatically when the resource that registered them stops, so it is safe to register again on restart.
๐ป Example
exports['kartik-clothing']:onCharacterCreated(function(appearance)
-- The starter outfit is now on the ped and saved.
for _, comp in ipairs(appearance.components or {}) do
print(('component %d = %d/%d'):format(comp.component_id, comp.drawable, comp.texture))
end
end)๐ก Event
The same appearance is sent as a client event:
AddEventHandler('kartik-clothing:client:characterCreated', function(appearance)
print('character created')
end)