Sync consumed ammo with server properly

No more security issues here!
This commit is contained in:
ElPumpo
2020-03-22 09:43:43 +01:00
parent ff9930068f
commit 9a1dfa42ca
4 changed files with 48 additions and 56 deletions
+20 -14
View File
@@ -20,11 +20,18 @@ end
ESX.GetWeapon = function(weaponName)
weaponName = string.upper(weaponName)
local weapons = ESX.GetWeaponList()
for i=1, #weapons, 1 do
if weapons[i].name == weaponName then
return i, weapons[i]
for k,v in ipairs(Config.Weapons) do
if v.name == weaponName then
return k, v
end
end
end
ESX.GetWeaponFromHash = function(weaponHash)
for k,v in ipairs(Config.Weapons) do
if GetHashKey(v.name) == weaponHash then
return v
end
end
end
@@ -35,24 +42,23 @@ end
ESX.GetWeaponLabel = function(weaponName)
weaponName = string.upper(weaponName)
local weapons = ESX.GetWeaponList()
for i=1, #weapons, 1 do
if weapons[i].name == weaponName then
return weapons[i].label
for k,v in ipairs(Config.Weapons) do
if v.name == weaponName then
return v.label
end
end
end
ESX.GetWeaponComponent = function(weaponName, weaponComponent)
weaponName = string.upper(weaponName)
local weapons = ESX.GetWeaponList()
local weapons = Config.Weapons
for i=1, #weapons, 1 do
if weapons[i].name == weaponName then
for j=1, #weapons[i].components, 1 do
if weapons[i].components[j].name == weaponComponent then
return weapons[i].components[j]
for k,v in ipairs(Config.Weapons) do
if v.name == weaponName then
for k2,v2 in ipairs(v.components) do
if v2.name == weaponComponent then
return v2
end
end
end