Jump to content

max ammo


#BrosS

Recommended Posts

Posted

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

 

من أراد الفشل عليه بالنجاح

Posted (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 by loki2143
Posted
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 

من أراد الفشل عليه بالنجاح

Posted
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?

Posted
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

من أراد الفشل عليه بالنجاح

Posted
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 )

 

- Hashemite Kingdom Of Jordan -

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...