nut.char
Character Management Library.
This module provides core logic for character creation, storage, validation, and synchronization in the NutScript framework. It manages character variables, metadata, and interactions across the server and client, enabling features like whitelisting, model selection, faction assignment, and inventory linking.
Functions
nut.char.create (data, callback)
nut.char.create
Internal
This is used internally - although you're able to use it you probably shouldn't.
Creates a new character in the database with the given data.
Parameters:
table data The character data table (name, model, faction, etc.)function
callback
optional
Callback function triggered after creation (receives charID)
nut.char.restore (client, callback, noCache, id)
nut.char.restore
Internal
This is used internally - although you're able to use it you probably shouldn't.
Restores a player's characters from the database.
Parameters:
Client client The player whose characters are being restoredfunction callback Function to call when restoration is complete
boolean
noCache
optional
If true, skips caching (unused in current implementation)
number
id
optional
Specific character ID to restore
nut.char.cleanUpForPlayer (client)
nut.char.cleanUpForPlayer
Internal
This is used internally - although you're able to use it you probably shouldn't.
Cleans up all character data for a player when they disconnect.
Parameters:
Client client The player whose character data should be cleaned upnut.char.delete (id, client)
nut.char.delete
Internal
This is used internally - although you're able to use it you probably shouldn't.
Deletes a character from the database and cleans up related data.
Parameters:
number id The character ID to deleteClient
client
optional
Player associated with the character
nut.char.new (data, id, client, steamID)
nut.char.new
Creates a new character object with the given data and metadata.
Parameters:
table data A table containing the character data.integer id The ID of the character.
Client client The player associated with the character.
string
steamID
optional
The SteamID of the player associated with the character.