FrameworkZ API - PLAYER
PLAYER
Player class for FrameworkZ.
0
Functions
36
Methods
1
Fields
📋 On This Page
- Overview
- Statistics
- Fields1
- Methods36
- PLAYER:Destroy
- PLAYER:GenerateUID
- PLAYER:GetCharacter
- PLAYER:GetCharacterDataByID
- PLAYER:GetCharacters
- PLAYER:GetCustomData
- PLAYER:GetIsoPlayer
- PLAYER:GetMaxCharacters
- PLAYER:GetPreviousCharacter
- PLAYER:GetRole
- PLAYER:GetSaveableData
- PLAYER:GetSteamID
- PLAYER:GetStoredData
- PLAYER:GetUsername
- PLAYER:GetWhitelists
- PLAYER:Initialize
- PLAYER:InitializeDefaultFactionWhitelists
- PLAYER:IsWhitelisted
- PLAYER:LoadCharacter
- PLAYER:PlayLocalSound
- PLAYER:RestoreData
- PLAYER:Save
- PLAYER:SetCharacter
- PLAYER:SetCharacters
- PLAYER:SetCustomData
- PLAYER:SetIsoPlayer
- PLAYER:SetMaxCharacters
- PLAYER:SetModel
- PLAYER:SetPreviousCharacter
- PLAYER:SetRole
- PLAYER:SetSteamID
- PLAYER:SetUsername
- PLAYER:SetWhitelisted
- PLAYER:SetWhitelists
- PLAYER:StopSound
- PLAYER:ValidatePlayerData
Fields
1
PLAYER
📋 table
Player class for FrameworkZ.
Initial value:
{}Methods
36PLAYER:Destroy(callback)
method
Destroys the player object.
Returns
🏷️ mixed
of \boolean Whether or not the player was successfully destroyed and \string The message on success or failure.
PLAYER:GenerateUID()
method
undocumented
No documentation available
PLAYER:GetCharacter()
method
Get the player's currently loaded character.
Returns
❔ CHARACTER?
The currently loaded character object or nil if no character is loaded.
PLAYER:GetCharacterDataByID(characterID, callback)
method
Get character data by character ID with optional async callback.
Parameters
characterID
🔢 number
The ID of the character to retrieve.
callback (optional)
⚡ function
Optional callback function(data, message) for async retrieval.
Returns
📋 table | ✅ boolean
Character data table or false if not found.
📝 string
Message describing success or failure.
PLAYER:GetCharacters()
method
Get all characters owned by this player.
Returns
📋 table
Table of character data indexed by character ID.
PLAYER:GetCustomData()
method
Get the player's custom data table.
Returns
📋 table
The custom data table for storing additional player information.
PLAYER:GetIsoPlayer()
method
Get the player's IsoPlayer object.
Returns
🏷️ IsoPlayer
The Project Zomboid IsoPlayer object associated with this player.
PLAYER:GetMaxCharacters()
method
Get the maximum number of characters the player can create.
Returns
🔢 number
The maximum character limit for this player.
PLAYER:GetPreviousCharacter()
method
Get the player's previous character ID.
Returns
🔢 number
The ID of the character the player last played.
PLAYER:GetRole()
method
Get the player's role.
Returns
📝 string
The player's current role (User, Operator, Moderator, Admin, Super_Admin, or Owner).
PLAYER:GetSaveableData()
method
Get player data suitable for saving/serialization.
Returns
📋 table
Filtered player data table ready for saving.
PLAYER:GetSteamID()
method
Get the player's Steam ID.
Returns
📝 string
The player's Steam ID.
PLAYER:GetStoredData()
method
Get the stored player mod data table.
Returns
📋 table
The raw FZ_PLY mod data table stored on the IsoPlayer.
PLAYER:GetUsername()
method
Get the player's username.
Returns
📝 string
The player's username.
PLAYER:GetWhitelists()
method
Get the player's faction whitelists.
Returns
📋 table
Table mapping faction IDs to whitelist status (true/false).
PLAYER:Initialize()
method
Initializes the player object.
Returns
📝 string
The username of the player.
PLAYER:InitializeDefaultFactionWhitelists()
method
Initialize default faction whitelists for the player based on faction settings.
PLAYER:IsWhitelisted(factionID)
method
Check if the player is whitelisted for a specific faction.
Parameters
factionID
📝 string
The faction ID to check.
Returns
✅ boolean
True if whitelisted, false otherwise.
PLAYER:LoadCharacter(characterID, callback)
method
undocumented
No documentation available
Parameters (inferred)
characterID
unknown
Parameter inferred from function signature
callback
unknown
Parameter inferred from function signature
PLAYER:PlayLocalSound(soundName)
method
Plays a sound for the player that only they can hear.
Parameters
soundName
📝 string
The name of the sound to play.
Returns
🔢 integer
The sound's ID.
PLAYER:RestoreData(data)
method
Restore player data from saved data table.
Parameters
data
📋 table
The saved player data containing Role, MaxCharacters, PreviousCharacter, Whitelists, and CustomData.
PLAYER:Save(callback)
method
Saves the player's data.
Parameters
callback (optional)
⚡ function
Optional callback(success, message) invoked after server save confirmation.
Returns
✅ boolean
Whether or not the player save was initiated.
PLAYER:SetCharacter(character)
method
Set the player's currently loaded character.
Parameters
character
🏷️ CHARACTER
The character object to set as the loaded character.
PLAYER:SetCharacters(characters)
method
Set the characters table for this player.
Parameters
characters
📋 table
Table of character data indexed by character ID.
PLAYER:SetCustomData(customData)
method
Set the player's custom data table.
Parameters
customData
📋 table
The custom data table to store.
Returns
❔ boolean?
True if set successfully, false if invalid input.
PLAYER:SetIsoPlayer(isoPlayer)
method
Set the player's IsoPlayer object.
Parameters
isoPlayer
🏷️ IsoPlayer
The IsoPlayer object (read-only, cannot be changed after creation).
PLAYER:SetMaxCharacters(maxCharacters)
method
Set the maximum number of characters the player can create.
Parameters
maxCharacters
🔢 number
The maximum character limit (must be at least 1).
Returns
❔ boolean?
True if set successfully, false if invalid input.
PLAYER:SetModel(characterData)
method
undocumented
No documentation available
Parameters (inferred)
characterData
unknown
Parameter inferred from function signature
Returns (inferred)
⭕ void
Return type inferred from function name pattern
PLAYER:SetPreviousCharacter(previousCharacter)
method
Set the player's previous character ID.
Parameters
previousCharacter
🔢 number
The character ID to set as previous character.
Returns
❔ boolean?
True if set successfully, false if invalid input.
PLAYER:SetRole(role)
method
Set the player's role.
Parameters
role
📝 string
The role to set (read-only, cannot be changed after creation).
PLAYER:SetSteamID(steamID)
method
Set the player's Steam ID.
Parameters
steamID
📝 string
The Steam ID (read-only, cannot be changed after creation).
PLAYER:SetUsername(username)
method
Set the player's username.
Parameters
username
📝 string
The username (read-only, cannot be changed after creation).
PLAYER:SetWhitelisted(factionID, whitelisted)
method
Set the player's whitelist status for a specific faction.
Parameters
factionID
📝 string
The faction ID to update whitelist status for.
whitelisted
✅ boolean
Whether the player is whitelisted for this faction.
Returns
❔ boolean?
True if set successfully, false if faction ID not provided.
PLAYER:SetWhitelists(whitelists)
method
Set the player's faction whitelists table.
Parameters
whitelists
📋 table
Table mapping faction IDs to whitelist status.
Returns
❔ boolean?
True if set successfully, false if invalid input.
PLAYER:StopSound(soundNameOrID)
method
Stops a sound for the player.
Parameters
soundNameOrID
🏷️ mixed
of \string or \integer The name or ID of the sound to stop.
PLAYER:ValidatePlayerData()
method
undocumented
No documentation available