Skip to content

Commit

Permalink
Add distance check for net-safe event "esx:onPickup"
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenshiin13 committed Aug 20, 2023
1 parent 7253c54 commit aa1ea63
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions [core]/es_extended/server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,12 @@ if not Config.OxInventory then
local pickup, xPlayer, success = Core.Pickups[pickupId], ESX.GetPlayerFromId(source)

if pickup then
local playerPickupDistance = #(pickup.coords - xPlayer.getCoords(true))
if(playerPickupDistance > 5.0) then
print(('[^3WARNING^7] Player Detected Cheating (Out of range pickup): ^5%s^7'):format(xPlayer.getIdentifier()))
return
end

if pickup.type == 'item_standard' then
if xPlayer.canCarryItem(pickup.name, pickup.count) then
xPlayer.addInventoryItem(pickup.name, pickup.count)
Expand Down

0 comments on commit aa1ea63

Please sign in to comment.