What seems to the problem with this code?


(Seph64) #1
	if ( g_knifeonly.integer != 1 ) {
		// Field ops gets binoculars, ammo pack, artillery, and a grenade
		if ( pc == PC_FIELDOPS ) {
			AddWeaponToPlayer( client, WP_AMMO, 0, 1, qfalse );

			if( AddWeaponToPlayer( client, WP_BINOCULARS, 1, 0, qfalse ) ) {
				client->ps.stats[STAT_KEYS] |= ( 1 << INV_BINOCS );
			}

			AddWeaponToPlayer( client, WP_SMOKE_MARKER, GetAmmoTableData(WP_SMOKE_MARKER)->defaultStartingAmmo, GetAmmoTableData(WP_SMOKE_MARKER)->defaultStartingClip, qfalse );

			if( client->sess.sessionTeam == TEAM_AXIS ) {
				switch( client->sess.playerWeapon ) {
				case WP_THOMPSON:
					AddWeaponToPlayer( client, WP_THOMPSON, GetAmmoTableData(WP_THOMPSON)->defaultStartingAmmo, GetAmmoTableData(WP_THOMPSON)->defaultStartingClip, qtrue );
				break;
				default:
				    AddWeaponToPlayer( client, WP_MP40,  GetAmmoTableData(WP_MP40)->defaultStartingAmmo, GetAmmoTableData(WP_MP40)->defaultStartingClip, qtrue );
				break;
				}
				AddWeaponToPlayer( client, WP_GRENADE_LAUNCHER,  0, 1, qfalse );
			} else {
				switch( client->sess.playerWeapon ) {
				case WP_MP40:
					AddWeaponToPlayer( client, WP_MP40,  GetAmmoTableData(WP_MP40)->defaultStartingAmmo, GetAmmoTableData(WP_MP40)->defaultStartingClip, qtrue );
				break;
				default:
					AddWeaponToPlayer( client, WP_THOMPSON, GetAmmoTableData(WP_THOMPSON)->defaultStartingAmmo, GetAmmoTableData(WP_THOMPSON)->defaultStartingClip, qtrue );
				break;
				}
				AddWeaponToPlayer( client, WP_GRENADE_PINEAPPLE, 0, 1, qfalse );
			}

I am trying to make it so that the Field Ops can wield either the MP40 or the Thompson regardless of their team. Is there something in cgame that I am missing?


(talkingc) #2

I assume you’re talking about the limbo weapon choosing thing; Did you add the WP_MP40/WP_THOMPSON to the classes defined in bg_classes.c - coz they need to be set there also in order to be seen in the limbo menu…

-tcm


(Seph64) #3

I’ll try that, thanks. :banana:

:clap: Three cheers for my hero! Hmm, thanks, I probably would have figured that out sooner or later.