Athena.player.currency ​
Type Aliases ​
DefaultCurrency ​
Ƭ DefaultCurrency: "bank" | "cash"
Defined in ​
Functions ​
add ​
Usage
Athena.player.currency.add<CustomCurrency>(player, type, amount): boolean
Add currency type to the player.
Example ​
const didAddFullAmount = Athena.player.currency.add(somePlayer, 'cash', 25);Type parameters ​
| Name |
|---|
CustomCurrency |
Parameters ​
| Name | Type |
|---|---|
player | Player |
type | CustomCurrency | DefaultCurrency |
amount | number |
Returns ​
boolean
Defined in ​
override ​
Usage
Athena.player.currency.override(functionName, callback): any
Used to override any internal currency functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "add" |
callback | <CustomCurrency>(player: Player, type: CustomCurrency | DefaultCurrency, amount: number) => boolean |
Returns ​
any
Defined in ​
Usage
Athena.player.currency.override(functionName, callback): any
Used to override any internal currency functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "set" |
callback | <CustomCurrency>(player: Player, type: DefaultCurrency | CustomCurrency, amount: number) => boolean |
Returns ​
any
Defined in ​
Usage
Athena.player.currency.override(functionName, callback): any
Used to override any internal currency functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "sub" |
callback | <CustomCurrency>(player: Player, type: DefaultCurrency | CustomCurrency, amount: number) => boolean |
Returns ​
any
Defined in ​
Usage
Athena.player.currency.override(functionName, callback): any
Used to override any internal currency functions.
Parameters ​
| Name | Type |
|---|---|
functionName | "subAllCurrencies" |
callback | (player: Player, amount: number) => boolean |
Returns ​
any
Defined in ​
set ​
Usage
Athena.player.currency.set<CustomCurrency>(player, type, amount): boolean
Replace the current currency type value with this exact value.
Example ​
const didSetFullAmount = Athena.player.currency.set(somePlayer, 'bank', 25);Type parameters ​
| Name |
|---|
CustomCurrency |
Parameters ​
| Name | Type | Description |
|---|---|---|
player | Player | - |
type | DefaultCurrency | CustomCurrency | Type of currency we are modifying. |
amount | number | The amount we want to set that type to. |
Returns ​
boolean
Defined in ​
sub ​
Usage
Athena.player.currency.sub<CustomCurrency>(player, type, amount): boolean
Remove currency type from the player.
Example ​
const didSubFullAmount = Athena.player.currency.sub(somePlayer, 'cash', 25);Type parameters ​
| Name |
|---|
CustomCurrency |
Parameters ​
| Name | Type |
|---|---|
player | Player |
type | DefaultCurrency | CustomCurrency |
amount | number |
Returns ​
boolean
Defined in ​
subAllCurrencies ​
Usage
Athena.player.currency.subAllCurrencies(player, amount): boolean
Only subtracts 'bank' and 'cash' currency types. Always takes from cash first.
Example ​
const didRemoveFullAmount = Athena.player.currency.subAllCurrencies(somePlayer, 25);Parameters ​
| Name | Type | Description |
|---|---|---|
player | Player | An alt:V Player Entity |
amount | number |
Returns ​
boolean
V5 Docs