Index: server/w_shotgun.qc
===================================================================
--- server/w_shotgun.qc	(revision 5311)
+++ server/w_shotgun.qc	(working copy)
@@ -1,4 +1,4 @@
-
+float washit;
 void W_Shotgun_Attack (void)
 {
 	float	sc;
@@ -15,9 +15,10 @@
 
 	W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
 	for (sc = 0;sc < bullets;sc = sc + 1)
-		fireBullet (w_shotorg, w_shotdir, spread, d, f, WEP_SHOTGUN, sc < 3);
+		washit += fireBullet (w_shotorg, w_shotdir, spread, d, f, WEP_SHOTGUN, sc < 3);
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_primary_ammo");
+	W_HitScanStats(self.weapon, washit);
 
 	pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_primary_ammo"));
 
@@ -58,9 +59,10 @@
 
 	W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
 	for (sc = 0;sc < bullets;sc = sc + 1)
-		fireBullet (w_shotorg, w_shotdir, spread, d, f, WEP_SHOTGUN | HITTYPE_SECONDARY, sc < 3);
+		washit += fireBullet (w_shotorg, w_shotdir, spread, d, f, WEP_SHOTGUN | HITTYPE_SECONDARY, sc < 3);
 	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 		self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
+	W_HitScanStats(self.weapon, washit);
 
 	pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_secondary_ammo"));
 
@@ -83,6 +85,8 @@
 	flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
 }
 
+
+
 // weapon frames
 void shotgun_fire2_03()
 {
Index: server/w_uzi.qc
===================================================================
--- server/w_uzi.qc	(revision 5311)
+++ server/w_uzi.qc	(working copy)
@@ -1,3 +1,4 @@
+float washit;
 // leilei's fancy muzzleflash stuff
 void W_Uzi_Flash_Go() {
 	if (self.frame > 10){
@@ -34,9 +35,10 @@
 	ATTACK_FINISHED(self) = time + cvar("g_balance_uzi_first_refire");
 
 	if (self.uzi_bulletcounter == 1)
-		fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_first_spread"), cvar("g_balance_uzi_first_damage"), cvar("g_balance_uzi_first_force"), deathtype, TRUE);
+		washit = fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_first_spread"), cvar("g_balance_uzi_first_damage"), cvar("g_balance_uzi_first_force"), deathtype, TRUE);
 	else
-		fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_sustained_spread"), cvar("g_balance_uzi_sustained_damage"), cvar("g_balance_uzi_sustained_force"), deathtype, (self.uzi_bulletcounter & 3) == 0);
+		washit = fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_sustained_spread"), cvar("g_balance_uzi_sustained_damage"), cvar("g_balance_uzi_sustained_force"), deathtype, (self.uzi_bulletcounter & 3) == 0);
+	W_HitScanStats(self.weapon, washit);
 
 	pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
Index: server/g_triggers.qc
===================================================================
--- server/g_triggers.qc	(revision 5311)
+++ server/g_triggers.qc	(working copy)
@@ -744,7 +744,7 @@
 };
 
 
-void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float deathtype);
+float FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float deathtype);
 
 void misc_laser_aim()
 {
Index: server/w_common.qc
===================================================================
--- server/w_common.qc	(revision 5311)
+++ server/w_common.qc	(working copy)
@@ -1,3 +1,5 @@
+.float hitscan_bullets_fired[WEP_COUNT];
+.float hitscan_bullets_hit[WEP_COUNT];
 
 void W_GiveWeapon (entity e, float wep, string name)
 {
@@ -22,22 +24,26 @@
 	self = oldself;
 }
 
-void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float deathtype)
+float FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float deathtype)
 {
 	local vector hitloc, force, endpoint, dir;
 	local entity ent, endent;
 	local float endq3surfaceflags;
+	float did_hit;
+ 
+	did_hit = 0;
+ 
 	//local entity explosion;
-	
+ 
 	railgun_start = start;
 	railgun_end = end;
-
+ 
 	dir = normalize(end - start);
 	force = dir * bforce;
-
+ 
 	// go a little bit into the wall because we need to hit this wall later
 	end = end + dir;
-
+ 
 	// trace multiple times until we hit a wall, each obstacle will be made
 	// non-solid so we can hit the next, while doing this we spawn effects and
 	// note down which entities were hit so we can damage them later
@@ -47,28 +53,28 @@
 			traceline_antilag (self, start, end, FALSE, self, self.antilag_debug);
 		else
 			traceline_antilag (self, start, end, FALSE, self, ANTILAG_LATENCY(self));
-
+ 
 		// if it is world we can't hurt it so stop now
 		if (trace_ent == world || trace_fraction == 1)
 			break;
-
+ 
 		// make the entity non-solid so we can hit the next one
 		trace_ent.railgunhit = TRUE;
 		trace_ent.railgunhitloc = end;
 		trace_ent.railgunhitsolidbackup = trace_ent.solid;
-
+ 
 		// stop if this is a wall
 		if (trace_ent.solid == SOLID_BSP)
 			break;
-
+ 
 		// make the entity non-solid
 		trace_ent.solid = SOLID_NOT;
 	}
-
+ 
 	endpoint = trace_endpos;
 	endent = trace_ent;
 	endq3surfaceflags = trace_dphitq3surfaceflags;
-
+ 
 	// find all the entities the railgun hit and restore their solid state
 	ent = findfloat(world, railgunhit, TRUE);
 	while (ent)
@@ -77,10 +83,10 @@
 		ent.solid = ent.railgunhitsolidbackup;
 		ent = findfloat(ent, railgunhit, TRUE);
 	}
-
+ 
 	// spawn a temporary explosion entity for RadiusDamage calls
 	//explosion = spawn();
-
+ 
 	// find all the entities the railgun hit and hurt them
 	ent = findfloat(world, railgunhit, TRUE);
 	while (ent)
@@ -90,6 +96,11 @@
 		ent.railgunhitloc = '0 0 0';
 		ent.railgunhitsolidbackup = SOLID_NOT;
 		ent.railgunhit = FALSE;
+		
+	if((ent.flags & FL_CLIENT) && (ent.deadflag == DEAD_NO))
+           	 did_hit = 1;
+ 	if(ent.team != self.team)
+	   	 did_hit = 1;
 
 		// apply the damage
 		if (ent.takedamage || ent.classname == "case")
@@ -109,6 +120,8 @@
 	trace_endpos = endpoint;
 	trace_ent = endent;
 	trace_dphitq3surfaceflags = endq3surfaceflags;
+
+	return did_hit;
 }
 
 .float dmg_edge;
@@ -292,10 +305,11 @@
 	proj.oldvelocity = proj.velocity;
 }
 
-void fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer)
+float fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer)
 {
 	vector  end;
 	local entity e;
+	float ret;
 
 	if(cvar("g_ballistics_force"))
 	{
@@ -339,8 +353,25 @@
 			else
 				pointparticles(particleeffectnum("machinegun_impact"), trace_endpos, trace_plane_normal * 1000, 1);
 		}
-		Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * force);
+
+		ret = 0;
+
+			if(trace_ent.flags & FL_CLIENT)
+        if(trace_ent.deadflag == DEAD_NO)
+            ret = 1;
+ 
+        if(teamplay)
+        if(trace_ent.team == self.team)
+            ret = 0;
+ 
+        Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * force);
+ 
+        return ret;
+ 
+ 
 	}
+ 
+	return 0;
 }
 
 void W_PrepareExplosionByDamage(entity attacker, void() explode)
@@ -354,3 +385,23 @@
 	self.nextthink = time;
 	self.think = explode;
 }
+
+void W_HitScanStats(float weaponid, float washit)
+{
+  if not(self.isbot)
+  {
+    float f;
+    float e;
+    self.(hitscan_bullets_fired[weaponid - 1]) += 1;
+    if(washit)
+      self.(hitscan_bullets_hit[weaponid - 1]) += 1;
+    f = self.(hitscan_bullets_hit[weaponid - 1]);
+    e = self.(hitscan_bullets_fired[self.weapon - 1]);
+    self.(hitscan_bullets_hit[weaponid - 1]) = f;
+    f = GetWeaponHits(weaponid);
+    addstat(f , AS_INT, hitscan_bullets_hit[weaponid - 1]);
+    e = GetWeaponFired(weaponid);
+    addstat(e , AS_INT, hitscan_bullets_fired[weaponid - 1]);
+  }
+}
+
Index: server/w_nex.qc
===================================================================
--- server/w_nex.qc	(revision 5311)
+++ server/w_nex.qc	(working copy)
@@ -1,3 +1,4 @@
+float washit;
 void W_Nex_Attack (void)
 {
 	float flying;
@@ -6,7 +7,8 @@
 	W_SetupShot (self, '25 4 -4', TRUE, 5, "weapons/nexfire.wav");
 
 	yoda = 0;
-	FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), WEP_NEX);
+	washit = FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), WEP_NEX);
+	W_HitScanStats(self.weapon, washit);	
 
 	if(yoda && flying)
 		announce(self, "announcer/male/yoda.wav");
@@ -27,6 +29,7 @@
 	}
 }
 
+
 void spawnfunc_weapon_nex (void); // defined in t_items.qc
 
 float w_nex(float req)
Index: common/constants.qh
===================================================================
--- common/constants.qh	(revision 5311)
+++ common/constants.qh	(working copy)
@@ -233,6 +233,12 @@
 const float STAT_WEAPONS = 35;
 const float STAT_SWITCHWEAPON = 36;
 const float STAT_GAMESTARTTIME = 37;
+const float STAT_SHOTGUNSTAT1 = 38;
+const float STAT_UZISTAT1 = 39;
+const float STAT_NEXGUNSTAT1 = 40;
+const float STAT_SHOTGUNSTAT2 = 41;
+const float STAT_UZISTAT2 = 42;
+const float STAT_NEXGUNSTAT2 = 48; 
 const float CTF_STATE_ATTACK = 1;
 const float CTF_STATE_DEFEND = 2;
 const float CTF_STATE_COMMANDER = 3;
Index: common/items.qc
===================================================================
--- common/items.qc	(revision 5311)
+++ common/items.qc	(working copy)
@@ -2,7 +2,7 @@
 entity weapon_info[24];
 entity dummy_weapon_info;
 
-void register_weapon_real(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float pickupbasevalue, string modelname, string shortname, string wname)
+void register_weapon_real(float id, float(float) func, float ammotype, float i, float normalweapon, float canclimb, float dmgtype, float pickupbasevalue, string modelname, string shortname, string wname)
 {
 	entity e;
 	weapon_info[id - 1] = e = spawn();
@@ -23,6 +23,7 @@
 		e.spawnflags |= WEPSPAWNFLAG_CANCLIMB;
 	e.impulse = i;
 	e.bot_pickupbasevalue = pickupbasevalue;
+	e.damagetype = dmgtype;
 }
 float w_null(float dummy)
 {
@@ -44,6 +45,7 @@
 	dummy_weapon_info.spawnflags = 0;
 	dummy_weapon_info.impulse = -1;
 	dummy_weapon_info.bot_pickupbasevalue = 0;
+	dummy_weapon_info.damagetype = 0;
 	dummy_weapon_info.model2 = "";
 
 	float i;
@@ -87,32 +89,56 @@
 }
 
 #ifdef SVQC
-#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname) \
-	register_weapon_real(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname)
+#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,dmgtype,pickupbasevalue,modelname,shortname,wname) \
+	register_weapon_real(id,func,ammotype,i,normalweapon,canclimb,dmgtype,pickupbasevalue,modelname,shortname,wname)
 #else
 // no weapon funcs here!
-#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname) \
-	register_weapon_real(id,w_null,ammotype,i,normalweapon,canclimb,pickupbasevalue,modelname,shortname,wname)
+#define register_weapon(id,func,ammotype,i,normalweapon,canclimb,dmgtype,pickupbasevalue,modelname,shortname,wname) \
+	register_weapon_real(id,w_null,ammotype,i,normalweapon,canclimb,dmgtype,pickupbasevalue,modelname,shortname,wname)
 #endif
 
 void RegisterWeapons()
 {
 	// %weaponaddpoint
-	register_weapon(WEP_LASER,            w_laser,     0,              1, 1, 1,     0, "laser",     "laser",           "Laser");
-	register_weapon(WEP_SHOTGUN,          w_shotgun,   IT_SHELLS,      2, 1, 0,  2500, "shotgun",   "shotgun",         "Shotgun");
-	register_weapon(WEP_UZI,              w_uzi,       IT_NAILS,       3, 1, 0,  5000, "uzi",       "uzi",             "Machine Gun");
-	register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher, IT_ROCKETS,     4, 1, 1,  5000, "gl",        "grenadelauncher", "Mortar");
-	register_weapon(WEP_ELECTRO,          w_electro,   IT_CELLS,       5, 1, 0,  5000, "electro",   "electro",         "Electro");
-	register_weapon(WEP_CRYLINK,          w_crylink,   IT_CELLS,       6, 1, 0,  5000, "crylink",   "crylink",         "Crylink");
-	register_weapon(WEP_NEX,              w_nex,       IT_CELLS,       7, 1, 0, 10000, "nex",       "nex",             "Nex");
-	register_weapon(WEP_HAGAR,            w_hagar,     IT_ROCKETS,     8, 1, 1,  5000, "hagar",     "hagar",           "Hagar");
-	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher, IT_ROCKETS,     9, 1, 1, 10000, "rl",        "rocketlauncher",  "Rocket Launcher");
-	register_weapon(WEP_PORTO,            w_porto,     0,              0, 0, 0,     0, "porto" ,    "porto",           "Port-O-Launch");
-	register_weapon(WEP_MINSTANEX,        w_minstanex, IT_CELLS,       7, 0, 1, 10000, "minstanex", "minstanex",       "MinstaNex");
-	register_weapon(WEP_HOOK,             w_hook,      IT_CELLS,       0, 0, 1,     0, "hookgun",   "hook",            "Grappling Hook");
-	register_weapon(WEP_SEEKER,           w_seeker,    IT_ROCKETS,     8, 1, 0,     0, "seeker",    "seeker",          "T.A.G. Seeker");
-	register_weapon(WEP_HLAC,             w_hlac,      IT_CELLS,       6, 1, 0,     0, "hlac",      "hlac",            "Heavy Laser Assault Cannon");
-	register_weapon(WEP_CAMPINGRIFLE,              w_campingrifle,       IT_NAILS,       3, 1, 0,  5000, "campingrifle",       "campingrifle",             "Camping Rifle");
+	register_weapon(WEP_LASER,            w_laser,     0,              1, 1, 1, 2,     0, "laser",     "laser",           "Laser");
+	register_weapon(WEP_SHOTGUN,          w_shotgun,   IT_SHELLS,      2, 1, 0, 1,  2500, "shotgun",   "shotgun",         "Shotgun");
+	register_weapon(WEP_UZI,              w_uzi,       IT_NAILS,       3, 1, 0, 1, 5000, "uzi",       "uzi",             "Machine Gun");
+	register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher, IT_ROCKETS,     4, 1, 1, 2, 5000, "gl",        "grenadelauncher", "Mortar");
+	register_weapon(WEP_ELECTRO,          w_electro,   IT_CELLS,       5, 1, 0, 2, 5000, "electro",   "electro",         "Electro");
+	register_weapon(WEP_CRYLINK,          w_crylink,   IT_CELLS,       6, 1, 0, 2, 5000, "crylink",   "crylink",         "Crylink");
+	register_weapon(WEP_NEX,              w_nex,       IT_CELLS,       7, 1, 0, 1, 10000, "nex",       "nex",             "Nex");
+	register_weapon(WEP_HAGAR,            w_hagar,     IT_ROCKETS,     8, 1, 1, 2, 5000, "hagar",     "hagar",           "Hagar");
+	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher, IT_ROCKETS,     9, 1, 1, 2, 10000, "rl",        "rocketlauncher",  "Rocket Launcher");
+	register_weapon(WEP_PORTO,            w_porto,     0,              0, 0, 0, 0,    0, "porto" ,    "porto",           "Port-O-Launch");
+	register_weapon(WEP_MINSTANEX,        w_minstanex, IT_CELLS,       7, 0, 1, 1, 10000, "minstanex", "minstanex",       "MinstaNex");
+	register_weapon(WEP_HOOK,             w_hook,      IT_CELLS,       0, 0, 1, 0,    0, "hookgun",   "hook",            "Grappling Hook");
+	register_weapon(WEP_SEEKER,           w_seeker,    IT_ROCKETS,     8, 1, 0, 2,    0, "seeker",    "seeker",          "T.A.G. Seeker");
+	register_weapon(WEP_HLAC,             w_hlac,      IT_CELLS,       6, 1, 0, 2,    0, "hlac",      "hlac",            "Heavy Laser Assault Cannon");
+	register_weapon(WEP_CAMPINGRIFLE,    w_campingrifle, IT_NAILS,     3, 1, 0, 1,  5000, "campingrifle",   "campingrifle",  "Camping Rifle");
 
 	register_weapons_done();
 }
+
+float GetWeaponHits(float weaponid)
+ {
+   switch(weaponid)
+   {
+     case WEP_SHOTGUN:    return STAT_SHOTGUNSTAT1;
+     case WEP_UZI:        return STAT_UZISTAT1;
+     case WEP_NEX:        return STAT_NEXGUNSTAT1;
+ 
+     default:             error("no STAT associed to the current weapon");
+   }
+ }
+ 
+ float GetWeaponFired(float weaponid)
+ {
+   switch(weaponid)
+   {
+      case WEP_SHOTGUN:    return STAT_SHOTGUNSTAT2;
+      case WEP_UZI:        return STAT_UZISTAT2;
+      case WEP_NEX:        return STAT_NEXGUNSTAT2;
+ 
+      default:             error("no STAT associed to the current weapon");
+   }
+ }
Index: common/items.qh
===================================================================
--- common/items.qh	(revision 5311)
+++ common/items.qh	(working copy)
@@ -60,6 +60,8 @@
 entity get_weaponinfo(float id);
 string W_FixWeaponOrder(string order, float complete);
 void RegisterWeapons();
+float GetWeaponHits(float weaponid);
+float GetWeaponFired(float weaponid);
 
 #define WEPSPAWNFLAG_NORMAL 1
 #define WEPSPAWNFLAG_CANCLIMB 2
@@ -77,3 +79,4 @@
 .float impulse; // weapon impulse
 .float bot_pickupbasevalue; // bot weapon priority
 .string model2; // wpn- sprite name
+.float damagetype; // damage type, used for stats : 0 to exclude, 1 for hitscan, 2 for splash
Index: client/Defs.qc
===================================================================
--- client/Defs.qc	(revision 5311)
+++ client/Defs.qc	(working copy)
@@ -208,4 +208,6 @@
 
 // database for misc stuff
 float tempdb;
-vector hook_shotorigin;
+vector hook_shotorigin;
+
+float sb_showhitscanstats;
Index: client/Main.qc
===================================================================
--- client/Main.qc	(revision 5311)
+++ client/Main.qc	(working copy)
@@ -92,7 +92,9 @@
 	registercmd("+button3");
 	registercmd("-button3");
 	registercmd("+button4");
-	registercmd("-button4");
+	registercmd("-button4");
+	registercmd("+showhitscanstats");
+	registercmd("-showhitscanstats"); 
 	registercvar("sbar_usecsqc", "1");
 	registercvar("sbar_columns", "default", CVAR_SAVE);
@@ -292,6 +294,14 @@
 	} else if(strCmd == "-showscores") {
 		sb_showscores = false;
 		return true;
+	}
+	else if(strCmd == "+showhitscanstats") {
+		sb_showhitscanstats = true;
+		return true;
+	}
+	else if(strCmd == "-showhitscanstats") {
+		sb_showhitscanstats = false;
+		return true;
 	}
 	
 	return false;
Index: client/sbar.qc
===================================================================
--- client/sbar.qc	(revision 5311)
+++ client/sbar.qc	(working copy)
@@ -1448,6 +1448,164 @@
 	return 0;
 }
 
+const vector weapon_width1 = '64 24 0';
+float hitscan[6], acc[3], missed[3];
+
+void DrawHitscanStats(void)
+{
+	string s;
+	vector pos;
+	float center_x;
+	float rowname_width;
+	rowname_width = 10;
+	local float mystringlength;
+	local vector fillsize, barpos;
+	float j, i;
+
+	mystringlength = strlen("Bullets Hit");
+	
+	sbwidth = Sbar_GetWidth(6.5 * sbar_fontsize_y);
+
+	xmin = 0.5 * (vid_conwidth - sbwidth);
+	ymin = 20;
+
+	xmax = vid_conwidth - xmin;
+   	ymax = vid_conheight - 0.2*vid_conheight;
+
+	center_x = xmin + 0.5*sbwidth;
+	
+	pos_y = ymin;
+	pos_z = 0;
+
+	fillsize_x = sbwidth - 40;
+	fillsize_y = 140;
+	
+	barpos_x = xmin + 0.5;
+	barpos_y = 50;
+	
+	
+	drawfont = sbar_bigfont;
+	pos_x = center_x - stringwidth("Hitscan Accuracy", TRUE)*0.5*24;
+	drawstring(pos, "Hitscan Accuracy", '24 24 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+	pos_x = xmin;
+	pos_y += 24 + 4;
+	
+	
+	hitscan[0] = getstati(STAT_SHOTGUNSTAT1);
+	hitscan[1] = getstati(STAT_SHOTGUNSTAT2);
+	hitscan[2] = getstati(STAT_UZISTAT1);
+	hitscan[3] = getstati(STAT_UZISTAT2);
+	hitscan[4] = getstati(STAT_NEXGUNSTAT1);
+	hitscan[5] = getstati(STAT_NEXGUNSTAT2);
+
+	
+	float temp;
+	for(i = 0; i < 6; i = i + 2)	
+		{
+		acc[j] = 0;
+		temp = hitscan[i];
+		acc[j] = temp / hitscan[i + 1];
+		acc[j] = acc[j] * 100;
+		acc[j] = rint(acc[j]);
+		missed[j] = hitscan[i + 1] - temp;
+		j = j + 1;
+		}
+	
+	
+	pos_x = center_x - (3 * weapon_width1 + rowname_width)*0.50;
+	pos_y = 50;
+	for(j = 0; j < 3;)
+	{
+		pos_x += rowname_width;
+		if(acc[j] > 0)
+			{
+			if(acc[j] <= 33)
+				drawfill(pos, weapon_width1 + '0 75 0' , '1 0 0', 0.4, 0);
+			else if(acc[j] <= 66)
+				drawfill(pos, weapon_width1 + '0 75 0' , '1 1 0', 0.4, 0);
+			else if(acc[j] <= 100)
+				drawfill(pos, weapon_width1 + '0 75 0' , '0 1 0', 0.4, 0);
+			}
+		pos_x += weapon_width1;
+		j = j + 1;
+	}
+
+	pos_x = center_x - (3 * weapon_width1 + rowname_width)*0.50;
+	pos_y = 50;
+	pos_x += rowname_width;
+	drawpic(pos, "gfx/inv_weapon1", weapon_width1 , '1 1 1', sbar_alpha_fg, 0);
+	pos_x += weapon_width1;
+	pos_x += rowname_width;
+	drawpic(pos, "gfx/inv_weapon2", weapon_width1 , '1 1 1', sbar_alpha_fg, 0);
+	pos_x += weapon_width1;
+	pos_x += rowname_width;
+	drawpic(pos, "gfx/inv_weapon6", weapon_width1 , '1 1 1', sbar_alpha_fg, 0);
+	pos_x += weapon_width1;
+	
+
+	pos_x = center_x - (3 * weapon_width1 + rowname_width)*0.50;  //for hits
+	pos_y = 80;
+	for(i = 0; i < 6;)
+		{
+		s = strcat(ftos(hitscan[i]), "\n");
+		pos_x += rowname_width;
+		drawstring(pos, s, '10 10 0', '1 1 1', 1, 0);
+		pos_x += weapon_width1;
+		i = i + 2;
+		}
+	
+
+	pos_x = center_x - (3 * weapon_width1 + rowname_width)*0.50; //for fired
+	pos_y = 120;
+	for(i = 1; i < 6;)
+		{
+		s = strcat(ftos(hitscan[i]), "\n");
+		pos_x += rowname_width;
+		drawstring(pos, s, '10 10 0', '1 1 1', 1, 0);
+		pos_x += weapon_width1;
+		i = i + 2;
+		}
+
+	pos_x = center_x - (3 * weapon_width1 + rowname_width)*0.50; //for % accuracy
+	pos_y = 140;
+	for(j = 0; j < 3;)
+		{
+		s = strcat(ftos(acc[j]),"%", "\n");
+		pos_x += rowname_width;
+		drawstring(pos , s, '10 10 0', '1 1 1', 1, 0);
+		pos_x += weapon_width1;
+		j = j + 1;
+		}
+	
+	
+
+	pos_x = center_x - (3 * weapon_width1 + rowname_width)*0.50;  //for missed
+	pos_y = 100;
+	for(j = 0; j < 3;)
+		{
+		s = strcat(ftos(missed[j]), "\n");
+		pos_x += rowname_width;
+		drawstring(pos, s, '10 10 0', '1 1 1', 1, 0);
+		pos_x += weapon_width1;
+		j = j + 1;
+		}	
+
+
+	pos_x = center_x - strlen("Bullets Hit:")*10 - 39;
+  	pos_y = 80;
+  	drawstring(pos, "Bullets Hit:", '10 10 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+  	pos_x = center_x - strlen("Bullets Missed:")*10 - 30;
+  	pos_y = 100;
+  	drawstring(pos, "Bullets Missed:", '10 10 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+  	pos_x = center_x - strlen("Bullets Fired:")*10 - 31;
+  	pos_y = 120;
+  	drawstring(pos, "Bullets Fired:", '10 10 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+  	pos_x = center_x - strlen("Percent Accuracy:")*10 - 25;
+  	pos_y = 140;
+  	drawstring(pos, "Percent Accuracy:", '10 10 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+
+}
+
 vector Sbar_DrawNoteLine(vector offset, string s)
 {
 	dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
@@ -1571,12 +1729,20 @@
 
 	sb_lines = 24;
 
-	if (sb_showscores)
+	if (sb_showscores == 1)
+	{
 		Sbar_DrawScoreboard();
+	}
+	else if (sb_showhitscanstats == 1)
+	{
+		DrawHitscanStats();
+	}
 	else if (intermission == 1)
 	{
 		Sbar_DrawScoreboard();
 		return;
+		DrawHitscanStats();
+		return;
 	}
 	else if (intermission == 2)
 		Sbar_FinaleOverlay();
