The public API covers minor character requests, so an admin panel or a staff tool can list, approve and manage them. All exports are server-side.
These exports do not check who is calling. Verify the staff permission in your own resource before calling FamilyReview or FamilySetGrowth.
The exports need family.enabled = true. With minors disabled, FamilyPending returns 0 and the rest must not be called.
The request object
FamilyGet, FamilyList and the cuxial_multichar:family:Changed event return requests with this shape:
| Field | Type | Content |
|---|---|---|
citizenid | string | Citizenid of the minor |
status | string | pending, approved, rejected or revoked |
bond | string | biological or adopted |
father, mother | table / nil | { citizenid, name, onlineId }. onlineId is the server ID of the parent if that character is being played |
motivation | string | Text written by the player |
child | table | { firstname, lastname, dob, age, gender, nationality }. gender is 0 (male) or 1 (female) |
playerName | string | Name of the player who sent it |
license | string | License of the player |
onlineId | number / nil | Server ID of the player if connected |
reviewedBy, reviewNote | string / nil | Who reviewed it and the note |
reviewedAt, createdAt | number | Timestamps in milliseconds. reviewedAt is nil until the request is reviewed |
growth | table / nil | { enabled, height, max, min, shrink, adult }. Only for approved requests |
Exports
FamilyPending
Number of requests waiting for review.
---@return integer
local pending = exports.cuxial_multichar:FamilyPending()FamilyGet
One request by citizenid.
---@param citizenid string
---@return table? request
local request = exports.cuxial_multichar:FamilyGet('ABC12345')FamilyList
Paginated list of requests. It takes one table with these fields, all optional:
| Parameter | Type | Content |
|---|---|---|
status | string | pending (default), approved, rejected, revoked, history or all |
search | string | Filters by citizenid, player name or character name |
page | number | Page, from 1 |
pageSize | number | Rows per page. Default 25, maximum 100 |
Returns { rows, total, page, pages, counts }. counts holds pending, approved, rejected, revoked and online.
local result = exports.cuxial_multichar:FamilyList({ status = 'pending', page = 1 })
for _, request in ipairs(result.rows) do
print(request.citizenid, request.child.firstname, request.status)
endFamilyReview
Approves, rejects or revokes a request. It takes one table:
| Parameter | Type | Content |
|---|---|---|
citizenid | string | Citizenid of the minor |
decision | string | approve or reject for pending requests. revoke for approved ones |
note | string | Optional note shown to the player. Up to 300 characters |
reviewer | table | { name } of the staff member. Saved as Staff when missing |
Returns true, or an error string: 'not_found' (no request for that citizenid), 'bad_state' (the decision does not fit the current status) or 'bad_decision' (unknown decision).
local result = exports.cuxial_multichar:FamilyReview({
citizenid = 'ABC12345',
decision = 'approve',
note = 'Welcome',
reviewer = { name = GetPlayerName(source) },
})Revoking a minor who is being played sends that player back to the selection.
FamilySetGrowth
Sets the height rules of an approved minor. It takes one table. Every call saves the four rules: the ones you leave out are saved as false, and max as the current height.
| Parameter | Type | Content |
|---|---|---|
citizenid | string | Citizenid of the minor |
enabled | boolean | Lets the player change height with the growth command |
max | number | Maximum height in cm. Not lower than the current height and not higher than 200 |
shrink | boolean | Lets the player go below the current height |
adult | boolean | Removes the scaling: the character uses the adult size |
Returns true, or an error string: 'not_found' (no request for that citizenid), 'bad_state' (the request is not approved) or 'bad_range' (max out of range).
exports.cuxial_multichar:FamilySetGrowth({
citizenid = 'ABC12345',
enabled = true,
max = 165,
shrink = false,
adult = false,
})Events
cuxial_multichar👪Changed
Server event. Fires when a request is created, reviewed, changed with FamilySetGrowth or deleted. It receives the request object, with status set to 'deleted' when the character was deleted.
AddEventHandler('cuxial_multichar:family:Changed', function(request)
-- request.status: 'pending', 'approved', 'rejected', 'revoked' or 'deleted'
print(request.citizenid, request.status)
end)State bag
cuxialScale is set on the player while they play an approved minor. It holds the scale factor (height divided by the adult reference height). It is nil for everyone else, and for minors marked as adult. It is replicated, so clients can read it too.
local scale = Player(source).state.cuxialScale