π€Exports
This document outlines the usage and functionality of functions provided by the script.
Exports Use
exports['resourceName']:functionNmae(args)
Replace de resourceName with the name of the resource, then change the functionName with one of the functions below, then add the args needed for the function.
1. Function: getCoins(source)
getCoins(source)
Description: This function retrieves the number of coins associated with a player identified by their source.
Parameters:
source
(integer): The source of the player.
Returns:
coins
(integer): The number of coins the player has.nil
if the player does not have any coins or if an error occurs during retrieval.
2. Function: setCoins(source, amount)
setCoins(source, amount)
Description: This function sets the number of coins for a player identified by their source to a specified amount.
Parameters:
source
(integer): The source of the player.amount
(integer): The new amount of coins to set for the player.
Returns:
nil
if the operation is successful.'Coins cant be negative'
if the provided amount is negative.
3. Function: addCoins(source, amount)
addCoins(source, amount)
Description: This function adds a specified amount of coins to the current balance of a player identified by their source.
Parameters:
source
(integer): The source of the player.amount
(integer): The amount of coins to add to the player's current balance.
Returns:
nil
if the operation is successful.
4. Function: removeCoins(source, amount)
removeCoins(source, amount)
Description: This function removes a specified amount of coins from the current balance of a player identified by their source.
Parameters:
source
(integer): The source of the player.amount
(integer): The amount of coins to remove from the player's current balance.
Returns:
nil
if the operation is successful.'Coins cant be negative'
if the resulting balance would be negative after removal.
Notes:
These functions utilize the
GetResourceKvpString
,SetResourceKvp
, andTriggerClientEvent
functions internally.Ensure that appropriate error handling is implemented to handle cases where player data retrieval or manipulation fails.
Last updated