Skip to content

Flags

Character permission and access control system for the Lilia framework.


Overview

The flags library provides a comprehensive permission system for managing character abilities and access rights in the Lilia framework. It allows administrators to assign specific flags to characters that grant or restrict various gameplay features and tools. The library operates on both server and client sides, with the server handling flag assignment and callback execution during character spawning, while the client provides user interface elements for viewing and managing flags. Flags can have associated callbacks that execute when granted or removed, enabling dynamic behavior changes based on permission levels. The system includes built-in flags for common administrative tools like physgun, toolgun, and various spawn permissions. The library ensures proper flag validation and prevents duplicate flag assignments.

lia.flag.add(flag, Single, Single, desc, callback)

Purpose

Register a flag with description and optional grant/remove callback.

When Called

During framework setup to define permission flags.

Parameters

string flag Single-character flag id.

unknown Single character flag id.

unknown Single character flag id.

string desc Localization key or plain description.

function callback optional function(client, isGiven) for grant/remove side effects.

Example Usage

  lia.flag.add("B", "flagBuildMenu", function(client, isGiven)
      if isGiven then
          client:Give("weapon_physgun")
      else
          client:StripWeapon("weapon_physgun")
      end
  end)

lia.flag.onSpawn(client)

Purpose

Execute flag callbacks for a player on spawn, ensuring each flag runs once.

When Called

Automatically when characters spawn; can be hooked for reapplication.

Parameters

Player client Player whose flags should be processed.

Example Usage

  hook.Add("PlayerSpawn", "ApplyFlagWeapons", lia.flag.onSpawn)