Problem with Ammo Sync

Hi,
I have a problem with a function SetPedAmmo, because this function put the ammo in the weapon but don’t set the loadout in the users table of database, probably because there aren’t any insert on a table of xplayer.
When i call the function ESX.Saveplayer and i call the function json.encode(xPlayer.getLoadout(true) return the correct weapon loadout but with 0 ammo.
If i set the value of ammo by database all working in the right mode.
Any one know the reason for that=?
Thanks a lot.

SetPedAmmo is a native client function - should be setting it on the server.

xPlayer.updateWeaponAmmo(weaponname, ammocount) will update the stored value and send an event to the client. Otherwise, shooting after using SetPedAmmo should send a server event to sync the count.

1 Like

Thanks ! it’s correct and now it works! thaks a lot for your answer!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.