fix(server): Don't set money to 0 before respawn if amount is negative

This commit is contained in:
Jérémie N'gadi
2017-09-23 10:06:39 +02:00
parent 9428715784
commit 384b8c72a1
+18 -4
View File
@@ -15,8 +15,15 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(
local xPlayer = ESX.GetPlayerFromId(source)
if Config.RemoveCashAfterRPDeath then
xPlayer.removeMoney(xPlayer.getMoney())
xPlayer.setAccountMoney('black_money', 0)
if xPlayer.getMoney() > 0 then
xPlayer.removeMoney(xPlayer.getMoney())
end
if xPlayer.getAccount('black_money').money > 0 then
xPlayer.setAccountMoney('black_money', 0)
end
end
if Config.RemoveItemsAfterRPDeath then
@@ -42,8 +49,15 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeathRemoveMoney'
local xPlayer = ESX.GetPlayerFromId(source)
if Config.RemoveCashAfterRPDeath then
xPlayer.removeMoney(xPlayer.getMoney())
xPlayer.setAccountMoney('black_money', 0)
if xPlayer.getMoney() > 0 then
xPlayer.removeMoney(xPlayer.getMoney())
end
if xPlayer.getAccount('black_money').money > 0 then
xPlayer.setAccountMoney('black_money', 0)
end
end
if Config.EarlyRespawn and Config.EarlyRespawnFine then