ax.character¶
Source: gamemode/framework/libraries/sv_character.lua
Server-side character management for database operations and character lifecycle.
Documented functions: 6
Functions¶
ax.character:Create(payload, callback)ax.character:Delete(id, callback)ax.character:Kick(client, reason)ax.character:Load(client, character)ax.character:Restore(client, callback)ax.character:Sync(client, character, recipient)
ax.character:Create(payload, callback)¶
Create a new character in the database. Creates a character with the provided payload data and automatically creates an inventory. Calls the callback with the character and inventory objects upon completion.
Realm: server
Parameters
| Name | Type | Description |
|---|---|---|
payload |
table |
Character creation data containing variable values |
callback |
function |
Optional callback function called with (character, inventory) or (false) on failure |
Usage
ax.character:Delete(id, callback)¶
Delete a character from the database. Permanently removes a character and its associated inventory from the database.
Realm: server
Parameters
| Name | Type | Description |
|---|---|---|
id |
number |
The character ID to delete |
callback |
function |
Optional callback function called with success boolean |
Usage
ax.character:Kick(client, reason)¶
Kick a player out of their active character and return them to the menu.
Realm: server
Parameters
| Name | Type | Description |
|---|---|---|
client |
Player |
The player to kick out of their character |
reason |
string\|nil |
Optional reason to notify the player with |
Returns
boolean: True if a character was unloaded
Usage
ax.character:Load(client, character)¶
Load a character for a player. Associates a character with a player, syncs character data, and sets up inventory. Automatically respawns the player after loading the character.
Realm: server
Parameters
| Name | Type | Description |
|---|---|---|
client |
Player |
The player entity to load the character for |
character |
table |
The character object to load |
Usage
ax.character:Restore(client, callback)¶
Restore all characters for a player from the database. Loads all characters associated with the player's SteamID64 and sends them to the client.
Realm: server
Parameters
| Name | Type | Description |
|---|---|---|
client |
Player |
The player entity to restore characters for |
callback |
function |
Optional callback function called with the character array |
Usage
ax.character:Sync(client, character, recipient)¶
Synchronize character data to all clients or a specific recipient. Broadcasts character information to all connected players or a specific player for client-side access.
Realm: server
Parameters
| Name | Type | Description |
|---|---|---|
client |
Player |
The player associated with the character |
character |
table |
The character object to synchronize |
recipient |
Player |
Optional specific recipient; if nil, broadcasts to all |
Usage