Skip to content

Attributes

This page documents hooks in the attributes category.


AdjustStaminaOffset(client, offset)View Source

Purpose

Allows code to adjust the computed stamina gain or drain before it is applied.

Category

Attributes

Realm

Shared

Parameters

Player client The player whose stamina value is being updated.

number offset The pending stamina change for this tick. Negative values drain stamina and positive values regenerate it.

Returns

number|nil Return a replacement stamina offset to override the default value, or nil to leave it unchanged.

Example Usage

  hook.Add("AdjustStaminaOffset", "liaExampleAdjustStaminaOffset", function(client, offset)
      return (offset or 0) + 5
  end)

GetAttributeMax(client, id)View Source

Purpose

Allows schemas or modules to override the maximum value shown for an attribute in the F1 character information panel.

Category

Attributes

Realm

Shared

Parameters

Player client The local player whose character information is being displayed.

string id The unique attribute identifier currently being rendered.

Returns

number|nil Return a numeric maximum to override the default attribute limit. Return nil to keep the configured attribute maximum.

Example Usage

  hook.Add("GetAttributeMax", "liaExampleGetAttributeMax", function(client, id)
      if id == "stm" then return 150 end
  end)

GetCharMaxStamina(char)View Source

Purpose

Allows modules to override the stamina maximum used by the client-side stamina display and prediction logic.

Category

Attributes

Realm

Shared

Parameters

Character char The loaded character whose stamina cap is being queried.

Returns

number|nil Return a numeric stamina cap to override the default stamina value. Return nil to keep the configured default.

Example Usage

  hook.Add("GetCharMaxStamina", "liaExampleGetCharMaxStamina", function(char)
      if char and char:getAttrib("end", 0) >= 50 then return 125 end
  end)

PlayerStaminaGained(client)View Source

Purpose

Runs when a player's stamina recovers enough to clear the breathing slowdown state.

Category

Attributes

Realm

Server

Parameters

Player client The player whose stamina recovered.

Example Usage

  hook.Add("PlayerStaminaGained", "liaExamplePlayerStaminaGained", function(client)
      client:ChatPrint("You caught your breath.")
  end)

PlayerStaminaLost(client)View Source

Purpose

Runs when a player's stamina is drained to zero and the breathing slowdown state is enabled.

Category

Attributes

Realm

Server

Parameters

Player client The player whose stamina was exhausted.

Example Usage

  hook.Add("PlayerStaminaLost", "liaExamplePlayerStaminaLost", function(client)
      client:ChatPrint("You're exhausted.")
  end)