Thesicstar Posted April 1, 2019 Posted April 1, 2019 Hey Guys, i'm pretty new to RageMP scripting so it may just be me beeing dumb but: I'm trying to get all weapons with the corresponding ammo the player has equipped (client-side), but i simply just can't figure out how. I have read the wiki and searched the forums but there doesn't seem to be a solution. What i've tried so far: Player::weapon Player::weaponAmmo Player::weapons Weapons::all None of them seem to work, either returning 0 or "undefined". Also most of these aren't documented on the wiki, so i might just be using them wrong. I hope you guys can tell me what i'm doing wrong.
Division Posted April 3, 2019 Posted April 3, 2019 Am 1.4.2019 um 17:24 schrieb Thesicstar: Hey Guys, i'm pretty new to RageMP scripting so it may just be me beeing dumb but: I'm trying to get all weapons with the corresponding ammo the player has equipped (client-side), but i simply just can't figure out how. I have read the wiki and searched the forums but there doesn't seem to be a solution. What i've tried so far: Player::weapon Player::weaponAmmo Player::weapons Weapons::all None of them seem to work, either returning 0 or "undefined". Also most of these aren't documented on the wiki, so i might just be using them wrong. I hope you guys can tell me what i'm doing wrong. You mind posting a snippet on how you used this in your code? Here's a short example: var weapon_hash = mp.players.local.weapon; // returns weapon as a hash => uint let ammoClip = mp.players.local.getAmmoInClip(weapon_hash); // returns ur ammo in clip let ammoWeapon = mp.players.local.getWeaponAmmo(weapon_hash); // returns ur wep ammo 1
Thesicstar Posted April 9, 2019 Author Posted April 9, 2019 Am 3.4.2019 um 23:00 schrieb Division: let ammoWeapon = mp.players.local.getWeaponAmmo(weapon_hash); // returns ur wep ammo Ah! Thanks for the explanation, i thought this returns the ammo of the current equipped weapon so i just used it like mp.players.local.getWeaponAmmo(); So it was just my lack of API knowledge. Thanks a lot for the explanation!
Flow Posted April 27, 2019 Posted April 27, 2019 Seems not to work to get current ammo in players weapon clip. alsways returns a strange value above 20.000: var weapon_hash = localPlayer.weapon; var ammoInClip = mp.game.invoke("0x2E1202248937775C", localPlayer.handle, weapon_hash, false); // returns bullshit
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now