Money

The SD.Money module provides a set of functions to manage player finances.

Internal Conversion Function

  • ConvertMoneyType(moneyType) Converts generic money type terminology to framework-specific variants to ensure compatibility.

Money.AddMoney

Purpose: Adds a specified amount of money to a player's account. Parameters:

  • source (number): The player's server ID.

  • moneyType (string): The type of money to add (e.g., 'cash', 'bank').

  • amount (number): The amount of money to add.

Usage Example:

SD.Money.AddMoney(source, 'cash', 500)

Money.RemoveMoney

Purpose: Deducts a specified amount from a player's account. Parameters:

  • source (number): The player's server ID.

  • moneyType (string): The type of money to remove (e.g., 'cash', 'bank').

  • amount (number): The amount of money to remove.

Usage Example:

SD.Money.RemoveMoney(source, 'bank', 200)

Money.GetPlayerAccountFunds

Purpose: Retrieves the current balance of a specified money type from a player's account.

Parameters:

  • source (number): The player's server ID.

  • moneyType (string): The type of money to check (e.g., 'cash', 'bank'). Returns:

  • (number): The amount of money in the player's account of the specified type.

Usage Example:

local funds = SD.Money.GetPlayerAccountFunds(source, 'cash')
print("Player has $" .. funds .. " in cash.")

Last updated