SolvedHelp Please Coding Question

Posts 16 of 6 · Page 1 of 1
Help Please Coding Question
Is there a way to add 1 bullet to a clip in a gun, say the pistol had 2 bullets and 0 stock ammo
I want to add 1 bullet to the 2 existing bullets here is what i can do

self setWeaponAmmoClip( "m1911_mp", 1 );

but this only sets the clip to 1 when i want it to add 1 bullet to clip
Is there a way to do this?
Maybe a way to find out the current clip and then add 1 bullet or just something simple like
self setWeaponAmmoClip( "m1911_mp", +1 );
but i know that ^ doesn't work

Help is appreciated
-Littlegandhi1199
i was wondering if you could do that on mw2 also but black ops would be nice also
It's in my TF2 Mod, custom weapon stock and clip and it changes when you reload.
I have tried to use your code but i can't find where you define weapon or ammo or clip for the thread... Can you outline it a little more for me
Usage:
self thread doCrazyAmmo("ak47_mp", 69, 69);

Don't recommend trying it on guns that reload every shot (eg, spas).
Code:
doCrazyAmmo(weapon, clip, ammo)
{
	self thread doCrazyStock(weapon, clip, ammo);
	
	self endon("death");
	self endon("disconnect");
	self.ammoClip[weapon] = clip;
	while(1) 
	{
		self waittill("weapon_fired");
		if(self getCurrentWeapon() == weapon) 
		{
			self.ammoClip[weapon]--;
			self setWeaponAmmoClip(weapon, self.ammoClip[weapon]);
			if(self getWeaponAmmoStock() == 0)
				self switchToWeapon(weapon);
		}
	}
}

doCrazyStock(weapon, clip, ammo)
{
	self endon("death");
	self endon("disconnect");
	self.ammoStock[weapon] = ammo;
	while(1) 
	{
		self waittill("reload");
		if(self getCurrentWeapon() == weapon) 
		{
			toRemove = clip - self.ammoClip[weapon];
			self.ammoStock[weapon] -= toRemove;
			self.ammoClip[weapon] += toRemove; 
			if(self.ammoStock[weapon] >= 0) 
			{
				self setWeaponAmmoStock(weapon, self.ammoStock[weapon]);
				self setWeaponAmmoClip(weapon, self.ammoClip[weapon]);
			}
		}
	}
}
Posts 16 of 6 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?