ax.class¶
Source: gamemode/framework/libraries/sh_class.lua
Class management system for creating, storing, and retrieving class data.
Documented functions: 7
Functions¶
ax.class:CanBecome(class, client)ax.class:Get(identifier)ax.class:GetAll(filter)ax.class:HasAny(class, classes)ax.class:Include(directory, timeFilter)ax.class:Initialize()ax.class:IsValid(class)
ax.class:CanBecome(class, client)¶
Check if a player can become a specific class. Runs through hook validation and class-specific CanBecome functions.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
class |
string\|number |
The class 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.class:Get(identifier)¶
Get a class 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 class ID, index, or name to search for |
Returns
table|nil: The class table if found, nil otherwise
Usage
ax.class:GetAll(filter)¶
Get all loaded class instances. Returns the loaded class list, optionally filtered by faction or fuzzy name.
Realm: shared
Returns
table: Array of all class instances
Usage
ax.class:HasAny(class, classes)¶
Check if a class matches any in a list of classes. Used for validating if a class belongs to a set of allowed classes.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
class |
string\|number |
The class identifier to check |
classes |
table |
Array of class identifiers to compare against |
Returns
boolean: True if the class matches any in the list, false otherwise
Usage
if ax.class:HasAny(playerClass, {CLASS_SECURITY, CLASS_SCIENTIST}) then print("Player is security or scientist") end
ax.class:Include(directory, timeFilter)¶
Include and load class files from a directory. Recursively searches for class .lua files and loads them into the class system. Automatically handles shared/client/server file prefixes.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
directory |
string |
The directory path to search for class files |
Returns
boolean: True if the operation completed successfully, false on error
Usage
ax.class:Initialize()¶
Initialize the class system by loading all class files. Automatically includes classes from framework, modules, and schema directories. Called during framework boot to set up all available classes.
Realm: shared
Usage
ax.class:IsValid(class)¶
Check if a class exists and is valid. Validates class existence by attempting to retrieve it.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
class |
string\|number |
The class identifier to validate |
Returns
boolean: True if the class exists, false otherwise
Usage