ax.player¶
Source: gamemode/framework/libraries/sh_player.lua
Player management system for creating, storing, and retrieving player data.
Documented functions: 3
Functions¶
ax.player:GetVar(client, key, fallback, dataFallback)ax.player:RegisterVar(key, data)ax.player:SetVar(client, key, value, opts)
ax.player:GetVar(client, key, fallback, dataFallback)¶
Get a player variable's value. Retrieves a player variable with fallback to default or provided fallback value.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
client |
Player |
The player entity |
key |
string |
The variable name to retrieve |
fallback |
any |
Optional fallback value if variable is not set |
Returns
any: The variable value, default value, or fallback
Usage
ax.player:RegisterVar(key, data)¶
Register a new player variable. Creates a player variable with getter/setter methods and database integration. Automatically generates Get/Set methods unless disabled with bNoGetter/bNoSetter.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
key |
string |
The variable name |
data |
table |
Variable configuration including default, field, fieldType, etc. |
Usage
ax.player:SetVar(client, key, value, opts)¶
Set a player variable's value. Updates a player variable and handles networking and change callbacks.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
client |
Player |
The player entity |
key |
string |
The variable name to set |
value |
any |
The new value to set |
opts |
table\|nil |
Optional options: bNoNetworking, recipients, bNoDBUpdate |
Usage