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 "dollars")

Usage

client:AddCurrency(500, "dollars")

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

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

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 dollars, 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 "dollars")

player:GetMoney(uniqueID)

Convenience aliases for the default "dollars" currency These methods forward to the character's money methods

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

Realm: shared

Returns

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

Usage

local dollars = client:GetMoney()

player:HasCurrency(amount, uniqueID)

Realm: shared

Parameters

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

Usage

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

player:HasMoney(amount, uniqueID)

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

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 "dollars")

Usage

client:SetCurrency(1000, "dollars")

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

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

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 "dollars")

Usage

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

player:TakeMoney(amount, uniqueID)

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

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