Hello !
So i have esx_extraitems installed for my server and i come across a problem with the Ammo boxes. If i try using them when my pistol is put away i will get the notification that i have to take out my weapon first. So … far so good… Once i take my weapon out and try using a box i get this error :
SCRIPT ERROR: @esx_extraitems/server/main.lua:289: attempt to call a nil value (field ‘addWeaponAmmo’)
That segment of the script goes as this:
RegisterNetEvent(‘esx_extraitems:removebox’)
AddEventHandler(‘esx_extraitems:removebox’, function(hash, ammo, type)
local xPlayer = ESX.GetPlayerFromId(source)
if type == 'boxpistol' then
for k,v in pairs(Config.Weapons.Pistols) do
if (v.weaponHash == hash) then
xPlayer.addWeaponAmmo(v.weaponName, ammo)
if Config.Removeables.AmmoBoxes then
xPlayer.removeInventoryItem('boxpistol', 1)
xPlayer.showNotification(_U('used_boxpistol'))
end
break
else
xPlayer.showNotification(_U('not_suitable'))
end
end
I just can’t figure out what the problem is…
is it because the “addWeaponAmmo” is not used anymore and should be replaced by something else?