mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 01:38:52 +00:00
Fixed glitchs
New fixs for glitchs Not being able to duplicate weapons by staying on pressing enter Not being able to duplicate money/items and weapons by giving it in vehicles
This commit is contained in:
+19
-8
@@ -1159,17 +1159,24 @@ ESX.ShowInventory = function()
|
||||
local item = data.current.value
|
||||
local type = data.current.type
|
||||
|
||||
if data.current.action == 'give' then
|
||||
if data.current.action == 'give' then
|
||||
|
||||
if type == 'item_weapon' then
|
||||
|
||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
||||
local closestPed = GetPlayerPed(closestPlayer)
|
||||
|
||||
if closestPlayer == -1 or closestDistance > 3.0 then
|
||||
ESX.ShowNotification(_U('players_nearby'))
|
||||
else
|
||||
if closestPlayer ~= -1 or closestDistance > 3.0 then
|
||||
-- PERSONNE
|
||||
if not IsPedSittingInAnyVehicle(closestPed) then
|
||||
TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), type, item, 1)
|
||||
else
|
||||
ESX.ShowNotification(_U("in_vehicle"))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('players_nearby'))
|
||||
end
|
||||
menu.close()
|
||||
|
||||
else
|
||||
|
||||
@@ -1182,11 +1189,15 @@ ESX.ShowInventory = function()
|
||||
|
||||
local quantity = tonumber(data2.value)
|
||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
||||
|
||||
if closestPlayer == -1 or closestDistance > 3.0 then
|
||||
ESX.ShowNotification(_U('players_nearby'))
|
||||
local closestPed = GetPlayerPed(closestPlayer)
|
||||
if not IsPedSittingInAnyVehicle(closestPed) then
|
||||
if closestPlayer ~= -1 or closestDistance < 3.0 then
|
||||
TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), type, item, quantity)
|
||||
else
|
||||
ESX.ShowNotification(_U('players_nearby'))
|
||||
end
|
||||
else
|
||||
TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), type, item, quantity)
|
||||
ESX.ShowNotification(_U("in_vehicle"))
|
||||
end
|
||||
|
||||
menu2.close()
|
||||
|
||||
Reference in New Issue
Block a user