ax.rank¶
Source: gamemode/framework/libraries/sh_rank.lua
Rank management system for creating, storing, and retrieving rank data.
Documented functions: 7
Functions¶
ax.rank:CanBecome(rank, client)ax.rank:Get(identifier)ax.rank:GetAll(filter)ax.rank:HasAny(rank, ranks)ax.rank:Include(directory, timeFilter)ax.rank:Initialize()ax.rank:IsValid(rank)
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
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
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
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
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: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: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