Main Menu¶
This page documents hooks in the main menu category.
CanPlayerCreateChar(client, data)View Source
Purpose
Determines whether a player is allowed to create a character with the supplied creation data.
Category
Main Menu
Realm
Shared
Parameters
Player client The player attempting to create a character.
table data The submitted character creation data.
Returns
boolean|nil Return false to block character creation.
Example Usage
hook.Add("CanPlayerCreateChar", "liaExampleCanPlayerCreateChar", function(client, data)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
CharLoaded(character)View Source
Purpose
Runs after the client successfully loads a chosen character through the normal character selection flow.
Category
Main Menu
Realm
Client
Parameters
Character character The character object that finished loading on the client.
Example Usage
hook.Add("CharLoaded", "liaExampleCharLoaded", function(character)
print("[Characters] Loaded:", character:getName())
end)
ChooseCharacter(id)View Source
Purpose
Requests that the client load a specific character from the character list.
Category
Main Menu
Realm
Client
Parameters
number id The character ID to choose.
Returns
Deferred Resolves when the character is loaded or rejects with the server-provided error.
Example Usage
hook.Add("ChooseCharacter", "liaExampleChooseCharacter", function(id)
print("[MyModule] handled ChooseCharacter")
end)
ConfigureCharacterCreationSteps(self)View Source
Purpose
Allows modules to insert additional creation-step panels into the default character creation flow before the summary step is appended.
Category
Main Menu
Realm
Client
Parameters
Panel self The active `liaCharacterCreation` panel that owns the step list.
Example Usage
hook.Add("ConfigureCharacterCreationSteps", "liaExampleConfigureCharacterCreationSteps", function(self)
self:addStep(vgui.Create("liaCharacterSummary"), 1)
end)
CreateCharacter(data)View Source
Purpose
Validates and submits character-creation payload data to the server.
Category
Main Menu
Realm
Client
Parameters
table data The character field values to validate and send.
Returns
Deferred Resolves with the new character ID or rejects with the validation or server error.
Example Usage
hook.Add("CreateCharacter", "liaExampleCreateCharacter", function(data)
print("[MyModule] handled CreateCharacter")
end)
DeleteCharacter(id)View Source
Purpose
Requests deletion of a character by ID.
Category
Main Menu
Realm
Client
Parameters
number id The character ID to delete.
Example Usage
hook.Add("DeleteCharacter", "liaExampleDeleteCharacter", function(id)
print("[MyModule] handled DeleteCharacter")
end)
FilterCharModels(client, faction, data, index)View Source
Purpose
Allows code to filter which faction model choices appear in the default character creation model step.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing character creation.
table faction The faction table associated with the current creation selection.
any data The raw model choice data entry before it is displayed.
any index The model choice key used to identify the entry in creation context.
Returns
boolean|nil Return false to hide the model entry. Return nil or true to keep it available.
Example Usage
hook.Add("FilterCharModels", "liaExampleFilterCharModels", function(client, faction, data, index)
if index == "restricted_model" then return false end
end)
GetCharacterCreateButtonTooltip(client, currentChars, maxChars)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the create-character button.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the menu.
number currentChars The number of characters currently available to the player.
number maxChars The maximum number of character slots available to the player.
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterCreateButtonTooltip", "liaExampleGetCharacterCreateButtonTooltip", function(client, currentChars, maxChars)
if currentChars >= maxChars then
return "No free character slots"
end
end)
GetCharacterCreationSummary(client, context, summary, panel)View Source
Purpose
Allows code to replace the summary entry list shown on the final character creation step.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the summary step.
table context The accumulated character creation context gathered from prior steps.
table summary The default summary entry array built before external overrides run.
Panel panel The active `liaCharacterSummary` panel.
Returns
table|nil Return a replacement sequential summary table to override the default entries. Return nil to keep the generated summary.
Example Usage
hook.Add("GetCharacterCreationSummary", "liaExampleGetCharacterCreationSummary", function(client, context, summary, panel)
return summary
end)
GetCharacterDisconnectButtonTooltip(client)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the disconnect button.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the menu.
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterDisconnectButtonTooltip", "liaExampleGetCharacterDisconnectButtonTooltip", function(client)
return "Disconnect from the server"
end)
GetCharacterDiscordButtonTooltip(client, discordURL)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the Discord button.
Category
Main Menu
Realm
Client
Parameters
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterDiscordButtonTooltip", "liaExampleGetCharacterDiscordButtonTooltip", function(client, discordURL)
return "Join the community Discord"
end)
GetCharacterLoadButtonTooltip(client)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the load-character button.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the menu.
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterLoadButtonTooltip", "liaExampleGetCharacterLoadButtonTooltip", function(client)
return "Browse your available characters"
end)
GetCharacterLoadMainButtonTooltip(client)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the load-main-character button.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the menu.
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterLoadMainButtonTooltip", "liaExampleGetCharacterLoadMainButtonTooltip", function(client)
return "Load your configured main character"
end)
GetCharacterMountButtonTooltip(client)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the Workshop mount button.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the menu.
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterMountButtonTooltip", "liaExampleGetCharacterMountButtonTooltip", function(client)
return "Mount installed Workshop content"
end)
GetCharacterReturnButtonTooltip(client)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the return button while browsing characters.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the menu.
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterReturnButtonTooltip", "liaExampleGetCharacterReturnButtonTooltip", function(client)
return "Return to the main character menu"
end)
GetCharacterStaffButtonTooltip(client, hasStaffChar)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the staff-character button.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the menu.
boolean hasStaffChar Whether the player already has a staff character available.
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterStaffButtonTooltip", "liaExampleGetCharacterStaffButtonTooltip", function(client, hasStaffChar)
if hasStaffChar then
return "Open your staff character"
end
end)
GetCharacterWorkshopButtonTooltip(client, workshopURL)View Source
Purpose
Allows plugins or modules to override the tooltip shown on the Workshop button.
Category
Main Menu
Realm
Client
Parameters
Returns
string|nil Return a string to override the tooltip text. Returning nil allows the default behavior to continue.
Example Usage
hook.Add("GetCharacterWorkshopButtonTooltip", "liaExampleGetCharacterWorkshopButtonTooltip", function(client, workshopURL)
return "Open the server Workshop collection"
end)
GetMainCharacterID()View Source
Purpose
Allows code to override which character ID should be treated as the player's main character.
Category
Main Menu
Realm
Client
Returns
number|nil Return the character ID that should be loaded as the main character.
Example Usage
hook.Add("GetMainCharacterID", "liaExampleGetMainCharacterID", function()
return 15
end)
GetMaxPlayerChar(client)View Source
Purpose
Returns the total number of character slots available to a player.
Category
Main Menu
Realm
Shared
Parameters
Player client The player whose character slot limit should be calculated.
Returns
number The maximum number of characters the player may have.
Example Usage
hook.Add("GetMaxPlayerChar", "liaExampleGetMaxPlayerChar", function(client)
return 15
end)
IsCharacterCreationOverridden()View Source
Purpose
Allows a module or schema to suppress the default character creation flow and supply its own interface.
Category
Main Menu
Realm
Client
Returns
boolean|nil Return true to prevent the default character creation UI from opening. Return nil or false to keep the built-in flow.
Example Usage
hook.Add("IsCharacterCreationOverridden", "liaExampleIsCharacterCreationOverridden", function()
return true
end)
KickedFromChar(characterID, isCurrentChar)View Source
Purpose
Handles the clientside character menu state after the player is kicked from a character.
Category
Main Menu
Realm
Client
Parameters
number characterID The character ID the player was removed from.
boolean isCurrentChar Whether the removed character was the player's currently loaded character.
Example Usage
hook.Add("KickedFromChar", "liaExampleKickedFromChar", function(characterID, isCurrentChar)
print("[MyModule] handled KickedFromChar")
end)
LiliaLoaded()View Source
LoadMainCharacter()View Source
Purpose
Loads the player's configured main character through the normal character-selection flow.
Category
Main Menu
Realm
Client
Returns
Deferred|nil Returns the character-load deferred when a main character is available.
Example Usage
hook.Add("LoadMainCharacter", "liaExampleLoadMainCharacter", function()
print("[MyModule] handled LoadMainCharacter")
end)
ModifyCharacterCreationSummary(client, context, summary, panel)View Source
Purpose
Allows code to mutate the final character creation summary entries in place after any replacement summary has been resolved.
Category
Main Menu
Realm
Client
Parameters
Player client The local player viewing the summary step.
table context The accumulated character creation context gathered from prior steps.
table summary The mutable summary entry array that will be rendered.
Panel panel The active `liaCharacterSummary` panel.
Example Usage
hook.Add("ModifyCharacterCreationSummary", "liaExampleModifyCharacterCreationSummary", function(client, context, summary, panel)
summary[#summary + 1] = {
title = "Preview",
value = tostring(context.model or "")
}
end)
ModifyCharacterModel(entity, contextOrCharacter)View Source
Purpose
Allows code to adjust a preview model after its base model, skin, and bodygroups have been applied for character creation or character selection scenes.
Category
Main Menu
Realm
Client
Parameters
Entity entity The clientside model entity being displayed.
table|Character contextOrCharacter optional Either the creation context table, the loaded character being previewed, or nil when no extra context is supplied.
Example Usage
hook.Add("ModifyCharacterModel", "liaExampleModifyCharacterModel", function(entity, contextOrCharacter)
entity:SetAngles(Angle(0, 180, 0))
end)
OnCharacterCreationModelIconSet(icon, model, skin, bodyGroups)View Source
Purpose
Runs after a creation-model spawnicon has been configured so modules can further customize the preview icon.
Category
Main Menu
Realm
Client
Parameters
SpawnIcon icon The spawnicon panel representing the selectable character model.
string model The resolved model path assigned to the icon.
number skin The skin index assigned to the icon preview.
string bodyGroups The encoded bodygroup string passed to `SpawnIcon:SetModel`.
Example Usage
hook.Add("OnCharacterCreationModelIconSet", "liaExampleOnCharacterCreationModelIconSet", function(icon, model, skin, bodyGroups)
icon:SetTooltip(model)
end)
ResetCharacterPanel()View Source
SetMainCharacter(charID)View Source
Purpose
Sends the selected character ID to the server as the player's main character.
Category
Main Menu
Realm
Client
Parameters
number charID The character ID to store as the player's main character.
Example Usage
hook.Add("SetMainCharacter", "liaExampleSetMainCharacter", function(charID)
print("[MyModule] handled SetMainCharacter")
end)
SetupPlayerModel(entity, character)View Source
Purpose
Allows code to configure a clientside player preview model after it is spawned but before character-specific appearance tweaks are applied.
Category
Main Menu
Realm
Client
Parameters
Entity entity The clientside model entity being prepared for preview.
Character character optional An optional loaded character when the preview is built from character selection data.
Example Usage
hook.Add("SetupPlayerModel", "liaExampleSetupPlayerModel", function(entity, character)
entity:SetCycle(0)
end)
ShouldShowCharVarInCreation(key)View Source
Purpose
Allows code to hide specific character variable fields from the default creation flow while preserving fallback defaults in the outgoing payload.
Category
Main Menu
Realm
Client
Parameters
string key The character variable key being considered for the creation interface.
Returns
boolean|nil Return false to hide the field from the default creation UI. Return nil or true to leave the field available.
Example Usage
hook.Add("ShouldShowCharVarInCreation", "liaExampleShouldShowCharVarInCreation", function(key)
if key == "desc" then return false end
end)
SyncCharList(client)View Source
Purpose
Sends the current character list to a client that is viewing character selection.
Category
Main Menu
Realm
Server
Parameters
Player client The player who should receive the synchronized character list.
Example Usage
hook.Add("SyncCharList", "liaExampleSyncCharList", function(client)
if not IsValid(client) then return end
print(string.format("[MyModule] handled SyncCharList for %s", client:Name()))
end)