#BrosS Posted January 4, 2017 Share Posted January 4, 2017 Hey Guys, can i set players max weapons ammo , cause some of them use bugs and set ammo to 99999 , i want to set all the weapon ammo to 1000 my try : function getPedWeapons(ped) if ped and isElement(ped) and getElementType(ped) == "player" then for i=17,39 do local wep = getPedWeapon(ped,i) if wep and wep > 1500 then setWeaponAmmo(ped,wep,50) end end end end Link to comment
Mr.Loki Posted January 5, 2017 Share Posted January 5, 2017 (edited) Did you read the wiki? getPedWeapon returns the type of weapon in the current slot not the ammo so u need to get the player's total ammo for the weapons local maxAmmo = 1000 function getPedWeapons(ped) if isElement(ped) and getElementType(ped) == "player" then for i=17,39 do local wep = getPedWeapon(ped,i) if wep > 0 and getPedTotalAmmo(ped,i) > maxAmmo then setWeaponAmmo(ped,wep,maxAmmo) end end end end Edited January 5, 2017 by loki2143 Link to comment
#BrosS Posted January 5, 2017 Author Share Posted January 5, 2017 7 hours ago, loki2143 said: Did you read the wiki? getPedWeapon returns the type of weapon in the current slot not the ammo so u need to get the player's total ammo for the weapons local maxAmmo = 1000 function getPedWeapons(ped) if isElement(ped) and getElementType(ped) == "player" then for i=17,39 do local wep = getPedWeapon(ped,i) if wep > 0 and getPedTotalAmmo(ped,i) > maxAmmo then setWeaponAmmo(ped,wep,maxAmmo) end end end end i still can get 99999 ammo , didn't work Link to comment
^iiEcoo'x_) Posted January 5, 2017 Share Posted January 5, 2017 setWeaponProperty(id,_, "maximum_clip_ammo", 99999) Link to comment
Mr.Loki Posted January 5, 2017 Share Posted January 5, 2017 10 minutes ago, #_iMr,[E]coo said: setWeaponProperty(id,_, "maximum_clip_ammo", 99999) Clip ammo is the ammount of ammo that can be shot before reloading. 50 minutes ago, #BrosS said: i still can get 99999 ammo , didn't work where did u add the code and can you show me the code where the payers are getting the weapons? Link to comment
#BrosS Posted January 5, 2017 Author Share Posted January 5, 2017 30 minutes ago, loki2143 said: Clip ammo is the ammount of ammo that can be shot before reloading. where did u add the code and can you show me the code where the payers are getting the weapons? I used your code and put it on a client file, and i don't know where do they get all the weapons probably bug , and yes my weapon shop's max ammo buying is 1200 , means imposible to buy more than 1200 ammo of all weapons Link to comment
^iiEcoo'x_) Posted January 5, 2017 Share Posted January 5, 2017 52 minutes ago, loki2143 said: Clip ammo is the ammount of ammo that can be shot before reloading. I can verify that the ammunition had reached 0 refillable again @#BrosS I understand what you said you want to increase ammunition, 1,200 weapon a player and this is a good way to do it local W = getPedWeapon(source) local T = getPedTotalAmmo (source) giveWeapon ( source, W, T+1200 ) Link to comment
#BrosS Posted January 5, 2017 Author Share Posted January 5, 2017 @loki2143 can i do with table ? think better than for i=17,39 do Link to comment
^iiEcoo'x_) Posted January 5, 2017 Share Posted January 5, 2017 1 minute ago, #BrosS said: @loki2143 can i do with table ? think better than for i=17,39 do Yes Link to comment
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