Skip to content

ax.player.meta

Source: gamemode/modules/currencies/meta/sh_player.lua

Player meta extensions for currency management.

Documented functions: 10

Functions


player:AddCurrency(amount, uniqueID, bNoNetworking, recipients)

Realm: shared

Parameters

Name Type Description
uniqueID string The unique identifier of the currency (defaults to "default")

Usage

client:AddCurrency(500, "default")

player:AddMoney(amount, uniqueID, bNoNetworking, recipients)

Add default (alias for AddCurrency with "default").

Realm: shared

Parameters

Name Type Description
amount number The amount to add
bNoNetworking bool Optional flag to disable networking (server only)
recipients table Optional specific recipients for networking (server only)

Returns

  • number: The new total amount of default, or 0 if no character

Usage

client:AddMoney(500)

player:GetCurrency(amount, uniqueID)

Realm: shared

Parameters

Name Type Description
uniqueID string\|nil The unique identifier of the currency (defaults to "default")

player:GetMoney(uniqueID)

Convenience aliases for the default "default" currency

These methods forward to the character's money methods

Get default amount (alias for GetCurrency with "default").

Realm: shared

Returns

  • number: The amount of default, or 0 if no character

Usage

local default = client:GetMoney()

player:HasCurrency(amount, uniqueID)

Realm: shared

Parameters

Name Type Description
uniqueID string The unique identifier of the currency (defaults to "default")

Usage

if (client:HasCurrency(1000, "default")) then
    print("Player can afford this")
end

player:HasMoney(amount, uniqueID)

Check if player's character has default (alias for HasCurrency with "default").

Realm: shared

Parameters

Name Type Description
amount number The amount to check

Returns

  • bool: True if the character has at least this amount, false otherwise

Usage

if (client:HasMoney(1000)) then
    print("Can afford purchase")
end

player:SetCurrency(amount, uniqueID, bNoNetworking, recipients)

Realm: shared

Parameters

Name Type Description
uniqueID string The unique identifier of the currency (defaults to "default")

Usage

client:SetCurrency(1000, "default")

player:SetMoney(amount, uniqueID, bNoNetworking, recipients)

Set default amount (alias for SetCurrency with "default").

Realm: shared

Parameters

Name Type Description
amount number The amount to set
bNoNetworking bool Optional flag to disable networking (server only)
recipients table Optional specific recipients for networking (server only)

Usage

client:SetMoney(1000)

player:TakeCurrency(amount, uniqueID)

Realm: shared

Parameters

Name Type Description
uniqueID string The unique identifier of the currency (defaults to "default")

Usage

if (client:TakeCurrency(100, "default")) then
    print("Purchase successful")
end

player:TakeMoney(amount, uniqueID)

Remove default (alias for TakeCurrency with "default").

Realm: shared

Parameters

Name Type Description
amount number The amount to remove

Returns

  • bool: True if successful, false if no character or insufficient funds

Usage

if (client:TakeMoney(100)) then
    print("Purchase successful")
end