mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
fix: check if money is below 0
This commit is contained in:
@@ -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