Title: Adding Additional Items Post by: SkreamerVirii on September 03, 2008, 11:21:33 PM In this tutorial i will show you how to assign a certain player class an item in this case i will be assigning the binoculars to the soldier
So let us begin open g_client .c and scroll down to // Soldiers and Lieutenants get a 2-handed weapon if ( pc == PC_SOLDIER || pc == PC_LT ) { // JPW NERVE -- if LT is selected but illegal weapon, set to team-specific SMG if ((pc == PC_LT) && (client->sess.playerWeapon > 5)) { if (client->sess.sessionTeam == TEAM_RED) client->sess.playerWeapon = 3; else client->sess.playerWeapon = 4; } we are going to want to add this code client->ps.stats[STAT_KEYS] |= ( 1 << INV_BINOCS ); which was found when i scolled back up to this code // Lieutenant gets binoculars, ammo pack, artillery, and a grenade if ( pc == PC_LT ) { client->ps.stats[STAT_KEYS] |= ( 1 << INV_BINOCS ); COM_BitSet(client->ps.weapons, WP_AMMO); client->ps.ammo[BG_FindAmmoForWeapon(WP_AMMO)] = 0; client->ps.ammoclip[BG_FindClipForWeapon(WP_AMMO)] = 1; COM_BitSet(client->ps.weapons, WP_ARTY); client->ps.ammo[BG_FindAmmoForWeapon(WP_ARTY)] = 0; client->ps.ammoclip[BG_FindClipForWeapon(WP_ARTY)] = 1; So now that you know where i got lets put it in the same area in another class which in our case is the soldierclass so now make // Soldiers and Lieutenants get a 2-handed weapon if ( pc == PC_SOLDIER || pc == PC_LT ) { // JPW NERVE -- if LT is selected but illegal weapon, set to team-specific SMG if ((pc == PC_LT) && (client->sess.playerWeapon > 5)) { if (client->sess.sessionTeam == TEAM_RED) client->sess.playerWeapon = 3; else client->sess.playerWeapon = 4; } look like this // Soldiers and Lieutenants get a 2-handed weapon if ( pc == PC_SOLDIER || pc == PC_LT ) { client->ps.stats[STAT_KEYS] |= ( 1 << INV_BINOCS ); // JPW NERVE -- if LT is selected but illegal weapon, set to team-specific SMG if ((pc == PC_LT) && (client->sess.playerWeapon > 5)) { if (client->sess.sessionTeam == TEAM_RED) client->sess.playerWeapon = 3; else client->sess.playerWeapon = 4; } if you have any troubles try modifing this part of the code f ( pc == PC_SOLDIER || pc == PC_LT ) { to look like tis f ( pc == PC_SOLDIER ) { the reason i say that is because my player class code is different it is all independent for the most part ill explain in a future tutorial YOur done nw go compile and try using you binoculars while playing as the soldier i find the spacebar convienent to bind it itoo if you have any troubles just email me or post in the ri forums |