grenades / ammo pickup ?


(Hewster) #1

Hi,

I’ve made both pineapple and stick grenades
available to both teams, in a modified form.

But when players pick up an ammo pack, it
will only replenish the grenade type originally
specified for their relevant team, and I
cannot find where this is dealt with in the
code.

Any pointers would be greatly appreciated,

Cheers

Hewster


(Hewster) #2

Its ok, I’ve sorted it…

g_items.c around line 398 the code was this:

if (other->client->sess.sessionTeam == TEAM_RED)
weapon = WP_GRENADE_LAUNCHER;
else
weapon = WP_GRENADE_PINEAPPLE;
if (other->client->ps.ammoclip[BG_FindClipForWeapon(weapon)] < i)
other->client->ps.ammoclip[BG_FindClipForWeapon(weapon)]++;
COM_BitSet(other->client->ps.weapons,weapon);

I changed it to this:

		weapon = WP_GRENADE_LAUNCHER;
	if (other-&gt;client-&gt;ps.ammoclip[BG_FindClipForWeapon(weapon)] &lt; i)
		other-&gt;client-&gt;ps.ammoclip[BG_FindClipForWeapon(weapon)]++;
	COM_BitSet(other-&gt;client-&gt;ps.weapons,weapon);
		weapon = WP_GRENADE_PINEAPPLE;
	if (other-&gt;client-&gt;ps.ammoclip[BG_FindClipForWeapon(weapon)] &lt; i)
		other-&gt;client-&gt;ps.ammoclip[BG_FindClipForWeapon(weapon)]++;
	COM_BitSet(other-&gt;client-&gt;ps.weapons,weapon);

I dont know if this is the best way of doing it, but it works :grin:

Hewster