Merge pull request #51 from ElPumpo/master

Fixed famous ammo bug
This commit is contained in:
Jérémie N'gadi
2018-03-17 18:57:54 +01:00
committed by GitHub
+2 -1
View File
@@ -170,6 +170,7 @@ AddEventHandler('esx:addWeapon', function(weaponName, ammo)
local weaponHash = GetHashKey(weaponName)
GiveWeaponToPed(playerPed, weaponHash, ammo, false, false)
SetPedAmmo(playerPed, weaponHash, ammo) -- remove leftover ammo
end)
RegisterNetEvent('esx:removeWeapon')
@@ -178,6 +179,7 @@ AddEventHandler('esx:removeWeapon', function(weaponName)
local weaponHash = GetHashKey(weaponName)
RemoveWeaponFromPed(playerPed, weaponHash)
SetPedAmmo(playerPed, weaponHash, 0) -- remove leftover ammo
end)
-- Commands
@@ -337,7 +339,6 @@ AddEventHandler('esx:pickupWeapon', function(weaponPickup, weaponName,ammo)
local ped = GetPlayerPed(-1)
local playerPedPos = GetEntityCoords(ped, true)
print(ammo)
CreateAmbientPickup(GetHashKey(weaponPickup), playerPedPos.x + 2.0, playerPedPos.y, playerPedPos.z + 0.5, 0, ammo, 1, false, true)
end)