From 0a5ddfe1a85dafc26e0a03ef0b5848ce0ae386ba Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Wed, 23 Aug 2023 00:33:21 +0200 Subject: [PATCH] fix: check if money is below 0 --- server/player.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/player.lua b/server/player.lua index a7a44bc..eface4f 100644 --- a/server/player.lua +++ b/server/player.lua @@ -25,7 +25,7 @@ local function createCharacterTable(info) ---@return boolean function self.deductMoney(account, amount, reason) 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 if NDCore.players[self.source] then self.triggerEvent("ND:updateMoney", self.cash, self.bank) @@ -40,7 +40,7 @@ local function createCharacterTable(info) ---@return boolean function self.addMoney(account, amount, reason) 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 if NDCore.players[self.source] then self.triggerEvent("ND:updateMoney", self.cash, self.bank)