mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Fixed exploit: negative bills
Sending negative bills gives the target player money! This adds a simple check to see if the bill is a negative value.
This commit is contained in:
+5
-6
@@ -6,12 +6,15 @@ RegisterServerEvent('esx_billing:sendBill')
|
||||
AddEventHandler('esx_billing:sendBill', function(playerId, sharedAccountName, label, amount)
|
||||
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', sharedAccountName, function(account)
|
||||
|
||||
if account == nil then
|
||||
if amount < 0 then
|
||||
print('esx_billing: ' .. GetPlayerName(_source) .. ' tried sending a negative bill!')
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('negative_bill'))
|
||||
elseif account == nil then
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
|
||||
@@ -37,9 +40,7 @@ AddEventHandler('esx_billing:sendBill', function(playerId, sharedAccountName, la
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
|
||||
local xPlayer2 = ESX.GetPlayerFromId(xPlayers[i])
|
||||
@@ -64,9 +65,7 @@ AddEventHandler('esx_billing:sendBill', function(playerId, sharedAccountName, la
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user