Skip to content

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)

CharMenuClosed()View Source

Purpose

Runs after the active character menu has been removed.

Category

Main Menu

Realm

Client

Example Usage

  hook.Add("CharMenuClosed", "liaExampleCharMenuClosed", function()
      print("[MainMenu] Character menu closed")
  end)

CharMenuOpened(self)View Source

Purpose

Runs after the main character menu panel has been created and registered as the active character UI.

Category

Main Menu

Realm

Client

Parameters

Panel self The character menu panel instance that was opened.

Example Usage

  hook.Add("CharMenuOpened", "liaExampleCharMenuOpened", function(self)
      self:SetAlpha(255)
  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

Player client The local player viewing the menu.

string discordURL The configured Discord URL.

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

Player client The local player viewing the menu.

string workshopURL The configured Workshop URL.

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)

GetMainMenuPosition(character)View Source

Purpose

Allows plugins or modules to provide an override position and angle for the character main menu scene.

Category

Main Menu

Realm

Client

Parameters

Character character The character whose main menu position is being resolved.

Returns

Vector|nil, Angle|nil Return a position and angle to override the default main menu placement. Returning nil values allows the default behavior to continue.

Example Usage

  hook.Add("GetMainMenuPosition", "liaExampleGetMainMenuPosition", function(character)
      if character and character:getFaction() == FACTION_CITIZEN then
          return Vector(0, 0, 0), Angle(0, 90, 0)
      end
  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

Purpose

Opens the character menu after the framework has finished loading on the client.

Category

Main Menu

Realm

Client

Example Usage

  hook.Add("LiliaLoaded", "liaExampleLiliaLoaded", function()
      print("[MyModule] handled LiliaLoaded")
  end)

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)

LoadMainMenuInformation(info, character)View Source

Purpose

Allows plugins or modules to append extra information rows to the selected-character info panel.

Category

Main Menu

Realm

Client

Parameters

table info The mutable array of text rows shown in the info panel.

Character character The character currently being previewed.

Example Usage

  hook.Add("LoadMainMenuInformation", "liaExampleLoadMainMenuInformation", function(info, character)
      info[#info + 1] = "Steam Name: " .. LocalPlayer():Nick()
  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)

OpenCharacterMenu()View Source

Purpose

Opens the default character menu unless another hook overrides it.

Category

Main Menu

Realm

Client

Returns

Panel|nil The created character panel, when the default menu opens.

Example Usage

  hook.Add("OpenCharacterMenu", "liaExampleOpenCharacterMenu", function()
      print("[MyModule] handled OpenCharacterMenu")
  end)

OpenCharacterMenuOverride()View Source

Purpose

Allows code to replace the default character menu panel creation.

Category

Main Menu

Realm

Client

Returns

Panel|boolean|nil Return a panel to use instead of the default character menu, or any non-nil value to stop the default menu from opening.

Example Usage

  hook.Add("OpenCharacterMenuOverride", "liaExampleOpenCharacterMenuOverride", function()
      return true
  end)

ResetCharacterPanel()View Source

Purpose

Rebuilds the character panel when the current menu state no longer matches the player's session state.

Category

Main Menu

Realm

Client

Example Usage

  hook.Add("ResetCharacterPanel", "liaExampleResetCharacterPanel", function()
      print("[MyModule] handled ResetCharacterPanel")
  end)

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)

ShouldMenuButtonShow(buttonID)View Source

Purpose

Allows code to block the default character creation button before the menu enters the creation flow.

Category

Main Menu

Realm

Client

Parameters

string buttonID The menu action identifier being checked. This flow currently passes `"create"`.

Returns

boolean|string|nil Return false to block the button. A second return value may provide the reason shown by the caller.

Example Usage

  hook.Add("ShouldMenuButtonShow", "liaExampleShouldMenuButtonShow", function(buttonID)
      if buttonID == "create" then return false, "Creation disabled" end
  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)