ox_core: Player tweaks, and docs for accounts

This commit is contained in:
Linden committed 2022-07-27 20:16:30 +10:00
1 parent 7f99ef97e1
commit d21e19e9a3
4 files changed
+133 -28

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
---
title: Server
sidebar_position: 1
---
## Ox.GetAccounts
Return an instance of CAccount for the given charid or group.
```lua
local accounts = Ox.GetAccounts(owner)
```
You can use [player.getAccounts](../../Player/Server/methods.md#playergetaccounts) to to simplify access to an player accounts, however the standard function works for offline players.
You can refer to [vl_banking](https://github.com/Volumed/vl_banking) for a simple implementation of banking using ox_core accounts.
+45
View File
@@ -0,0 +1,45 @@
---
title: Methods
---
These functions are inherited by instances of CVehicle.
```lua
local accounts = Ox.GetAccounts(owner)
```
## accounts.get
Gets the current balance for an account.
```lua
local account = 'fleeca'
local balance = accounts.get(account)
```
## accounts.set
Sets the balance of an account to the given amount.
```lua
local account, newBalance = 'fleeca', 200
accounts.set(account, newBalance)
```
## accounts.add
Increases the balance of an account by the given amount.
```lua
local account, amount = 'fleeca', 100
accounts.add(account, amount)
```
## accounts.remove
Decreases the balance of an account by the given amount.
```lua
local account, amount = 'fleeca', 100
accounts.remove(account, amount)
```