mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
new docs
This commit is contained in:
1 parent
3cebaf7fa5
commit
b5eba8423f
229 files changed
+6238
-10690
No files matched your search
@@ -0,0 +1,30 @@
|
||||
## setPaymentMethod
|
||||
|
||||
Override the built-in payment method.
|
||||
|
||||
```lua
|
||||
exports.ox_fuel:setPaymentMethod(method)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
- method: `function(): boolean?`
|
||||
|
||||
### Example
|
||||
|
||||
```lua
|
||||
exports.ox_fuel:setPaymentMethod(function(playerId, amount)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
local bankAmount = xPlayer.getAccount('bank').money
|
||||
|
||||
if bankAmount >= amount then
|
||||
xPlayer.removeAccountMoney('bank', amount)
|
||||
return true
|
||||
end
|
||||
|
||||
TriggerClientEvent('ox_lib:notify', source, {
|
||||
type = 'error',
|
||||
description = locale('not_enough_money', amount - bankAmount)
|
||||
})
|
||||
end)
|
||||
```
|
||||
Reference in new issue
Block a user