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:
+2
-1
@@ -5,5 +5,6 @@ Locales['en'] = {
|
||||
['received_payment'] = 'you ~g~received~s~ a payment of ~r~$',
|
||||
['player_not_logged'] = 'the player is not logged in',
|
||||
['no_money'] = 'you do not have enough money to pay this bill',
|
||||
['target_no_money'] = 'The player ~r~does not~w~ have enough money to pay the bill!'
|
||||
['target_no_money'] = 'The player ~r~does not~w~ have enough money to pay the bill!',
|
||||
['negative_bill'] = 'You cannot send negative bills!'
|
||||
}
|
||||
|
||||
+2
-1
@@ -5,5 +5,6 @@ Locales['sv'] = {
|
||||
['received_payment'] = 'du har ~y~mottagit~w~ en räkning på ~g~$',
|
||||
['player_not_logged'] = 'spelaren är inte online',
|
||||
['no_money'] = 'du har ~r~inte råd~w~ för att kunna betala räkningen',
|
||||
['target_no_money'] = 'Spelaren har ~r~inte råd~w~ för att betala räkningen'
|
||||
['target_no_money'] = 'Spelaren har ~r~inte råd~w~ för att betala räkningen',
|
||||
['negative_bill'] = 'Du kan inte skicka negativa räkningar!'
|
||||
}
|
||||
|
||||
+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