Skip to content

ax.rank

Rank management system for creating, storing, and retrieving rank data.

Documented functions: 7  ·  Realm: shared

Functions


ax.rank:CanBecome(rank, client)

Check if a player can become a specific rank.

Runs through hook validation and rank-specific CanBecome functions.

Realm: shared

Parameters

Name Type Description
rank string\|number The rank ID, index, or name
client Player The player entity to check permissions for

Returns

  • boolean,: string|nil True if allowed, false if not. Error message if denied.

Usage

local canBecome, reason = ax.rank:CanBecome("security", player)

Source: gamemode/framework/libraries/sh_rank.lua:156


ax.rank:Get(identifier)

Get a rank by its identifier.

Supports lookup by unique ID string, index number, name, or partial name matching.

Realm: shared

Parameters

Name Type Description
identifier string\|number The rank ID, index, or name to search for

Returns

  • table|nil: The rank table if found, nil otherwise

Usage

local rank = ax.rank:Get("security")
local rank = ax.rank:Get(1)

Source: gamemode/framework/libraries/sh_rank.lua:130


ax.rank:GetAll(filter)

Get all loaded rank instances.

Returns the complete list of ranks indexed by their ID.

Realm: shared

Returns

  • table: Array of all rank instances

Usage

local allRanks = ax.rank:GetAll()

Source: gamemode/framework/libraries/sh_rank.lua:180


ax.rank:HasAny(rank, ranks)

Check if a rank matches any in a list of ranks.

Used for validating if a rank belongs to a set of allowed ranks.

Realm: shared

Parameters

Name Type Description
rank string\|number The rank identifier to check
ranks table Array of rank identifiers to compare against

Returns

  • boolean: True if the rank matches any in the list, false otherwise

Usage

if ax.rank:HasAny(playerRank, {RANK_SECURITY, RANK_SCIENTIST}) then print("Player is security or scientist") end

Source: gamemode/framework/libraries/sh_rank.lua:228


ax.rank:Include(directory, timeFilter)

Include and load rank files from a directory.

Recursively searches for rank .lua files and loads them into the rank system.

Automatically handles shared/client/server file prefixes.

Realm: shared

Parameters

Name Type Description
directory string The directory path to search for rank files

Returns

  • boolean: True if the operation completed successfully, false on error

Usage

ax.rank:Include("parallax/gamemode/ranks")

Source: gamemode/framework/libraries/sh_rank.lua:48


ax.rank:Initialize()

Initialize the rank system by loading all rank files.

Automatically includes ranks from framework, modules, and schema directories.

Called during framework boot to set up all available ranks.

Realm: shared

Usage

ax.rank:Initialize()

Source: gamemode/framework/libraries/sh_rank.lua:25


ax.rank:IsValid(rank)

Check if a rank exists and is valid.

Validates rank existence by attempting to retrieve it.

Realm: shared

Parameters

Name Type Description
rank string\|number The rank identifier to validate

Returns

  • boolean: True if the rank exists, false otherwise

Usage

if ax.rank:IsValid("security") then print("Rank exists") end

Source: gamemode/framework/libraries/sh_rank.lua:213