Jump to content
RAGE Multiplayer Community

Problem with getting Weapon Ammunition


Miep3r
 Share

Recommended Posts

I am currently working on a roleplay gamemode which uses a database for datastorage and I stumbled upon a problem while trying to save the players weapons and ammunition. I know there have already been threads discussing the topic of saving ammunition but every solution returned 0 for me.

I have tried:
player.getWeaponAmmo(weaponHash) [Server-Side]
mp.game.invoke("0x015A522136D7F951", mp.players.local.handle, weaponHash); [Client-Side]

 

Both of these have returned 0 for me, also by using different Weapons (Pistol, Carbine-Rifle). I hope that someone has a solution to this problem or could fix the player.getWeaponAmmo(weaponHash) command.
Regards,
Miep3r

Link to comment
Share on other sites

Are you passing the weaponHash or the weaponName? Because if in your code weaponHash equals to the name of the weapon, than it would not work.

Try this way with a pistol:

let pistolAmmo = mp.game.invoke("0x015A522136D7F951", mp.players.local.handle, mp.joaat('weapon_pistol'));

Basicaly mp.joaat() convert an entity name to hash, exactly what the function expects. Good luck!

Edited by Pilatus
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...