Skip to content

Flags

Flag helpers for registering character permission flags, storing flag metadata, reapplying flag callbacks on player spawn, and displaying available flags in the character information menu.


Overview

The flag library centralizes shared flag registration under `lia.flag`. Registered flags are stored in `lia.flag.list` with an optional localized description and callback. On the server, player spawn handling reapplies callbacks for each unique flag the player has. On the client, the information menu displays all registered flags and indicates whether the local character currently has each one.

lia.flag.add(flag, desc, callback)View Source

Purpose

Registers a character permission flag with an optional localized description and optional callback.

Realm

Shared

Parameters

string flag The single-character flag identifier to register.

string desc optional The language token or description for the flag. When provided, it is resolved through lia.lang.resolveToken before being stored.

function callback optional Optional function called when the flag is applied or removed by flag handling code. The callback receives the player and a boolean indicating whether the flag is being given.

Example Usage

  lia.flag.add("p", "@flagPhysgun", function(client, isGiven)
      if isGiven then
          client:Give("weapon_physgun")
      else
          client:StripWeapon("weapon_physgun")
      end
  end)

lia.flag.onSpawn(client)View Source

Purpose

Reapplies registered flag callbacks for every unique flag the player has when spawn handling runs.

Realm

Server

Parameters

Player client The player whose current flags should be processed.

Example Usage

  lia.flag.onSpawn(client)