ax.faction¶
Source: gamemode/framework/libraries/sh_faction.lua
Faction management system for creating, storing, and retrieving faction data.
Documented functions: 6
Functions¶
ax.faction:CanBecome(identifier, client)ax.faction:Get(identifier)ax.faction:GetAll()ax.faction:Include(directory, timeFilter)ax.faction:Initialize()ax.faction:IsValid(faction)
ax.faction:CanBecome(identifier, client)¶
Check if a player can join a specific faction. Runs through hook validation and faction-specific CanBecome functions.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
identifier |
string\|number |
The faction 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.faction:Get(identifier)¶
Get a faction 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 faction ID, index, or name to search for |
Returns
table|nil: The faction table if found, nil otherwise
Usage
ax.faction:GetAll()¶
Get all loaded faction instances. Returns the complete list of factions indexed by their team index.
Realm: shared
Returns
table: Array of all faction instances indexed by team number
Usage
ax.faction:Include(directory, timeFilter)¶
Include and load faction files from a directory. Recursively searches for faction .lua files and loads them into the faction system. Automatically handles shared/client/server file prefixes and sets up team data.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
directory |
string |
The directory path to search for faction files |
Returns
boolean: True if the operation completed successfully, false on error
Usage
ax.faction:Initialize()¶
Initialize the faction system by loading all faction files. Automatically includes factions from framework, modules, and schema directories. Called during framework boot to set up all available factions.
Realm: shared
Usage
ax.faction:IsValid(faction)¶
Check if a faction exists and is valid. Validates faction existence by attempting to retrieve it.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
faction |
string\|number |
The faction identifier to validate |
Returns
boolean: True if the faction exists, false otherwise
Usage