mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-11-27 13:24:46 +00:00
fix: check if money is below 0
This commit is contained in:
1 parent
26ae7ea1a3
commit
0a5ddfe1a8
1 file changed
+2
-2
+2
-2
@@ -25,7 +25,7 @@ local function createCharacterTable(info)
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
function self.deductMoney(account, amount, reason)
|
function self.deductMoney(account, amount, reason)
|
||||||
local amount = tonumber(amount)
|
local amount = tonumber(amount)
|
||||||
if not amount or account ~= "bank" and account ~= "cash" then return end
|
if not amount or amount <= 0 or account ~= "bank" and account ~= "cash" then return end
|
||||||
self[account] -= amount
|
self[account] -= amount
|
||||||
if NDCore.players[self.source] then
|
if NDCore.players[self.source] then
|
||||||
self.triggerEvent("ND:updateMoney", self.cash, self.bank)
|
self.triggerEvent("ND:updateMoney", self.cash, self.bank)
|
||||||
@@ -40,7 +40,7 @@ local function createCharacterTable(info)
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
function self.addMoney(account, amount, reason)
|
function self.addMoney(account, amount, reason)
|
||||||
local amount = tonumber(amount)
|
local amount = tonumber(amount)
|
||||||
if not amount or account ~= "bank" and account ~= "cash" then return end
|
if not amount or amount <= 0 or account ~= "bank" and account ~= "cash" then return end
|
||||||
self[account] += amount
|
self[account] += amount
|
||||||
if NDCore.players[self.source] then
|
if NDCore.players[self.source] then
|
||||||
self.triggerEvent("ND:updateMoney", self.cash, self.bank)
|
self.triggerEvent("ND:updateMoney", self.cash, self.bank)
|
||||||
|
|||||||
Reference in new issue
Block a user