ix.char
Character creation and management.
NOTE: For the most part you shouldn't use this library unless you know what you're doing. You can very easily corrupt character data using these functions!
Functions
ix.char.Create(data, callback)
View source »Creates a character object with its assigned properties and saves it to the database.
Parameters
-
data
table
Properties to assign to this character. If fields are missing from the table, then it will use the default value for that property
-
callback
function
Function to call after the character saves
ix.char.New(data, id, client, steamID)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Creates a new empty Character object. If you are looking to create a usable character, see ix.char.Create.
Parameters
-
data
table
Character vars to assign
-
id
number
Unique ID of the character
-
client
Player
Player that will own the character
-
steamID
string
default: client:SteamID64()
SteamID64 of the player that will own the character
ix.char.Restore(client, callback, bNoCache, id)
View source »Loads all of a player's characters into memory.
Parameters
-
client
Player
Player to load the characters for
-
callback
function
default: nil
Function to call when the characters have been loaded
-
bNoCache
boolean
default: false
Whether or not to skip the cache; players that leave and join again later will already have their characters loaded which will skip the database query and load quicker
-
id
number
default: nil
The ID of a specific character to load instead of all of the player's characters
ix.char.RestoreVars(data, characterInfo)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Adds character properties to a table. This is done automatically by ix.char.Restore, so that should be used instead if you are loading characters.
Parameters
-
data
table
Table of fields to apply to the table. If this is an SQL query object, it will instead populate the query with
SELECT
statements for each applicable character var in ix.char.vars.
Tables
ix.char.cache
View source »Functions similar to ix.char.loaded, but is serverside only. This contains a table of all loaded characters grouped by the SteamID64 of the player that owns them.
ix.char.loaded
View source »Characters that are currently loaded into memory. This is not a table of characters that players are currently using. Characters are automatically loaded when a player joins the server. Entries are not cleared once the player disconnects, as some data is needed after the player has disconnected. Clients will also keep their own version of this table, so don't expect it to be the same as the server's.
The keys in this table are the IDs of characters, and the values are the Character objects that the ID corresponds to.
Example Usage
print(ix.char.loaded[1])
> character[1]
ix.char.vars
View source »Variables that are stored on characters. This table is populated automatically by ix.char.RegisterVar
.
Example Usage
print(ix.char.vars["name"])
> table: 0xdeadbeef