Hello, Please anyone can help me find out a solution for this problem?
My ESX script got a loadout inventory weapon system, but the weapon ammo is not updating. When give weapon with ammo 100 and after some shots when i drop it. The ammo still 100 on ground.
I made a script to check the ammo updating still same.
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterCommand("testammo", function(source, args)
local xPlayer = ESX.GetPlayerFromId(source)
local loadoutNum, weapon = xPlayer.getWeapon('WEAPON_PISTOL')
TriggerEvent('esx:restoreLoadout')
if weapon then
print(xPlayer.loadout[loadoutNum].label)
print(xPlayer.loadout[loadoutNum].ammo)
else
print('weapon not found!')
end
end)
I taken the weapon after some shots, checked ammo by testammo cmd, still it shows same bullet amount as i given the gun.
Is there any way to update the ammo change to ESX? xPlayer.updateAmmo like that?? Can anyone please help me?