Exports, events and hooks
Everything another resource may call. Use exports.cc_illumium:... or, for scripts written against illenium, exports['illenium-appearance']:... (the manifest provides it, so both names reach the same f
Everything another resource may call. Use exports.cc_illumium:... or, for scripts written against illenium, exports['illenium-appearance']:... (the manifest provides it, so both names reach the same functions).
Server exports are trusted (only server code can call them). Client exports can only open menus and change the local ped's preview: a client can never set a price or save a look the server has not checked.
Server exports
| Export | Arguments | Returns | What it does |
|---|---|---|---|
getAppearance(src) | player id | appearance or nil | What the player wears now, uniform included |
getSavedAppearance(identifier) | citizenid / ESX identifier | appearance or nil | The saved look of any character, online or not |
saveAppearance(src, appearance) | player id, appearance | boolean | Sanitise and save a look (the model cannot change), put it on the player |
isInMenu(src) | player id | boolean | Whether the player has a menu open |
closeMenu(src) | player id | - | Close the player's menu; the saved look goes back on |
allowCreator(src) | player id | boolean | Let that character run the creator once more |
removeUniform(src) | player id | - | Take a uniform overlay off |
grantFreeSession(src, kind, opts) | player id, 'surgeon' or 'barber', { ttlMs? } | boolean, err | One free visit where the player stands (a perk, an item). Their next startPlayerCustomization uses it. One use, expires |
registerWardrobe(def) | { id, label, coords, heading, owners? } | boolean | Add a home closet at runtime (housing). owners = identifiers allowed; nil = anyone. Dropped when your resource stops |
unregisterWardrobe(id) | id | boolean | Remove a closet you registered |
getWardrobes() | - | table | A copy of every registered closet |
registerHook(name, fn) | hook name, function | id | Register a hook from another resource (see Hooks) |
getHooks() | - | table | Every hook with its payload description |
-- A housing script: one closet per owned house
exports.cc_illumium:registerWardrobe({
id = 'house_42', label = 'Bedroom closet',
coords = vector3(-174.3, 497.6, 137.6), heading = 190.0,
owners = { 'ABC12345' },
})
-- A supporter perk: one free surgeon visit
exports.cc_illumium:grantFreeSession(source, 'surgeon', { ttlMs = 120000 })
TriggerClientEvent('my_perks:openSurgeon', source) -- your client then calls startPlayerCustomizationClient exports
Our own
| Export | Arguments | Returns | What it does |
|---|---|---|---|
openStore(id) | store id from Config.Stores | boolean | Open the nearest store of that store's kind (the server checks distance) |
openWardrobe(id) | wardrobe id or nil | boolean | Open a wardrobe (the server checks who may) |
isMenuOpen() | - | boolean | Whether a menu is open |
saveOwnedLook() | - | boolean | Save what the ped wears now when every piece is already owned (item outfit bags). Nothing is charged; the server refuses anything not owned |
illenium-appearance compatible
Getters (default ped = the player): getPedModel(ped), getPedComponents(ped), getPedProps(ped), getPedHeadBlend(ped), getPedFaceFeatures(ped), getPedHeadOverlays(ped), getPedHair(ped), getPedAppearance(ped).
Setters (preview on the ped, never saved): setPlayerModel(model), setPedHeadBlend(ped, hb), setPedFaceFeatures(ped, ff), setPedHeadOverlays(ped, ho), setPedHair(ped, hair, tattoos), setPedEyeColor(ped, c), setPedComponent(ped, c), setPedComponents(ped, list), setPedProp(ped, p), setPedProps(ped, list), setPedTattoos(ped, t), setPedAppearance(ped, a), setPlayerAppearance(a).
Menus:
| Export | Behaviour in cc_illumium |
|---|---|
InitializeCharacter(gender, onSubmit, onCancel) | The creator (the server decides the character is new) |
startPlayerCustomization(cb, config) | A creator config (ped = true or enableExit = false) is the creator. Otherwise a granted free visit, else the nearest paid clothing store. Never a free full editor |
OpenCatalogLocker(entry) | The nearest store of the entry's kind |
Events other resources may fire (client)
| Event | From | Result |
|---|---|---|
illenium-appearance:client:reloadSkin | anyone | Re-load the saved look |
illenium-appearance:client:openClothingShop / OpenBarberShop / OpenTattooShop / OpenSurgeonShop | anyone | Nearest store of that kind |
illenium-appearance:client:openClothingShopMenu | anyone | Nearest clothing store (the free ped menu is refused) |
illenium-appearance:client:openOutfitMenu, qb-clothing:client:openOutfitMenu | anyone | The wardrobe |
illenium-appearance:client:loadJobOutfit, qb-clothing:client:loadOutfit | job lockers | Wear a uniform as an overlay |
qb-clothing:client:openMenu | admin tools | Creator if no saved skin, else nearest paid store |
qb-clothes:client:CreateFirstCharacter | qb / qbx multicharacter | The creator; answers qb-clothing:client:onMenuClose |
esx_skin:openSaveableMenu(submit, cancel) | ESX multicharacter / identity | The creator (Config.Compat.esxSkin) |
esx_skin:openMenu(submit, cancel) | ESX scripts | Creator if no saved skin, else nearest paid store |
skinchanger:loadSkin(skin, cb) | ESX | Re-load the saved look (the passed skin is ignored) |
skinchanger:loadDefaultModel(isMale, cb) | ESX | A bare freemode body |
skinchanger:loadClothes(skin, clothes) | ESX job lockers | Wear the clothes as an overlay |
skinchanger:getSkin(cb) | ESX | cb(appearance) with sex 0 / 1 added |
Events we fire
| Event | Side | Arguments | When |
|---|---|---|---|
cc_illumium:client:creatorFinished | client (local) | - | The creator saved |
qb-clothing:client:onMenuClose | client (local) | - | The creator closed (qb multicharacter waits for it) |
cc_illumium:server:creatorFinished | server (local) | src, identifier, appearance | A new character's look was saved |
cc_illumium:server:freeSessionUsed | server (local) | src, kind, grantedBy, appearance | A granted free visit was used |
cc_illumium:server:storeChanged | server (local) | storeId, why | A player-owned store changed hands or state |
Server-local events can only be fired by server code, so they are safe to trust.
Hooks
Register from custom/server.lua with CC.hooks.register(name, fn), or from another resource with exports.cc_illumium:registerHook(name, fn). Hooks narrow: what a hook hands back is re-checked (a price is clamped to 0..Prices.maxTotal, a look is sanitised again). A hook that errors is logged and ignored.
| Hook | Cancel (return false) | Mutable | Payload |
|---|---|---|---|
beforePurchase | refuses the checkout | price | source, kind, store, lines, price, quote (quote = true while only pricing, so the receipt shows your change) |
afterPurchase | - | - | source, kind, store, lines, price, account, appearance |
outfitAccess | blocks it | - | source, action (list wear share airdrop import), outfitId, group |
appearanceFilter | - | appearance | source, kind, appearance (sanitised again after you) |
Examples (VIP discount, closed parlours, uniform rules, forced decals) are in custom/server.lua, commented out.
custom/client.lua
| Function | Return | Use |
|---|---|---|
CustomClient.canOpen(kind, storeId) | boolean | false stops a menu opening |
CustomClient.isDowned() | boolean | Tell cc_illumium your death system downed the player |
CustomClient.onOpened(kind, storeId) | - | Hide your HUD |
CustomClient.onClosed(kind, storeId, committed) | - | Show it again |
The appearance object
illenium's shape, unchanged: model, components[] (component_id, drawable, texture), props[] (prop_id, drawable, texture; -1 = none), headBlend, faceFeatures, headOverlays, hair (style, texture, color, highlight), eyeColor, tattoos (per zone).