//** Killingspree, Firstblood und Headshot by Markus Lechner aka LSB Squall 69, http://lsb-snipers.com **//

Killingspree(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc){
	self endon("disconnected");
	
	//** Grösse und Koordinaten für Text **//
	Textsize = 2.0;
	xcoord = 0;
	ycoord = 0;
	
	
	
	if(!isDefined(eAttacker.KillsiRow)){
		eAttacker.KillsiRow = 0;
		eAttacker.EndSpree = 0;
	}
	
	if(!isDefined(self.KillsiRow)){
		self.KillsiRow = 0;
		self.EndSpree = 0;
	}
	
	//** Setzen der Variable für Killspree wenn Player stirbt **//
	if( self.KillsiRow  <= 2 ){
		self.KillsiRow = 0;
	}	
	
	
	if(isdefined(eAttacker.hud_costumprint))
	eAttacker.hud_costumprint destroy();
	
	if(isdefined(self.hud_costumprint))
	self.hud_costumprint destroy();
	
	
	//** Setzen der Variable wenn Killspree Ende **//
	if( self.KillsiRow >= 3 )
		self.EndSpree = 1;


	//** Check ob eine Killspree zu Ende ist **//
	if( self.EndSpree == 1 ){
		
		if( self.KillsiRow >= 19 )
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_GODLIKE" );
		
		else if( self.KillsiRow >= 17 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_UNSTOPABLE" );
		}
		
		else if( self.KillsiRow >= 15 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_SLAUGHTER" );
		}
		
		else if( self.KillsiRow >= 13 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_HOLYSHIT" );
		}
		
		else if( self.KillsiRow >= 11 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_MONSTERKILL" );
		}
		
		else if( self.KillsiRow >= 9 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_DOMINATING" );
		}
		
		else if( self.KillsiRow >= 7 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_RAMPAGE" );
		}
		
		else if( self.KillsiRow >= 5 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_ULTRAKILL" );
		}
		
		else if( self.KillsiRow >= 3 ){
			iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE2" , self.name , &"CUSTOM_KILLINGSPREE" );
		}
		
		self playLocalSound ( "monsterlache" );
		
		if( eAttacker != self ){
			eAttacker playLocalSound ( "wixxer" );
			self iprintln ( eAttacker.name , &"CUSTOM_ENDE_KILLSPREE1" );
		}
		
		//** Killingspree ist vorbei setze Variablen neu **//
		self.EndSpree = 0;
		self.KillsiRow = 0;
	}
	
	//** Check ob Killspree im Gange ist **//
	if( eAttacker != self ){	//** ohh für einen Selbstmord gibt es schon gar nix **//
		
		eAttacker.KillsiRow++;
		
		if( !isdefined ( eAttacker.hud_costumprint ) ){
			eAttacker.hud_costumprint = newClientHudElem ( eAttacker );
			eAttacker.hud_costumprint.horzAlign = "center";
			eAttacker.hud_costumprint.vertAlign = "top";
			eAttacker.hud_costumprint.Alignx = "center";
			eAttacker.hud_costumprint.x = xcoord;
			eAttacker.hud_costumprint.y = ycoord;
			eAttacker.hud_costumprint.font = "default";
			eAttacker.hud_costumprint.fontscale = Textsize;
		}
		
		if( eAttacker.KillsiRow == 3 ){
			iprintln ( eAttacker.name , &"CUSTOM_KILLINGSPREE" );
			eAttacker.hud_costumprint setText( &"CUSTOM_KILLINGSPREE" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("killingspree");}
			else eAttacker playLocalSound ("killingspree");
		}
	
		if( eAttacker.KillsiRow == 4 ){
			iprintln ( eAttacker.name , &"CUSTOM_KILLINGSPREE" );
			eAttacker.hud_costumprint setText( &"CUSTOM_KILLINGSPREE" );
		}
	
		if( eAttacker.KillsiRow == 5 ){
			iprintln ( eAttacker.name  , &"CUSTOM_ULTRAKILL" );
			eAttacker.hud_costumprint setText( &"CUSTOM_ULTRAKILL" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("ultrakill");}
			else eAttacker playLocalSound ("ultrakill");
		}
		
		if( eAttacker.KillsiRow == 6 ){
			iprintln ( eAttacker.name  , &"CUSTOM_ULTRAKILL" );
			eAttacker.hud_costumprint setText( &"CUSTOM_ULTRAKILL" );
		}
				
		if( eAttacker.KillsiRow == 7 ){
			iprintln ( eAttacker.name  , &"CUSTOM_RAMPAGE" );
			eAttacker.hud_costumprint setText( &"CUSTOM_RAMPAGE" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("rampage");}
			else eAttacker playLocalSound ("rampage");
		}
		
		if( eAttacker.KillsiRow == 8 ){
			iprintln ( eAttacker.name  , &"CUSTOM_RAMPAGE" );
			eAttacker.hud_costumprint setText( &"CUSTOM_RAMPAGE" );
		}

		if( eAttacker.KillsiRow == 9 ){
			iprintln ( eAttacker , &"CUSTOM_DOMINATING" );
			eAttacker.hud_costumprint setText( &"CUSTOM_DOMINATING" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("dominating");}
			else eAttacker playLocalSound ("dominating");
		}

		if( eAttacker.KillsiRow == 10 ){
			iprintln ( eAttacker , &"CUSTOM_DOMINATING" );
			eAttacker.hud_costumprint setText( &"CUSTOM_DOMINATING" );
		}
		
		if( eAttacker.KillsiRow == 11 ){
			iprintln ( eAttacker.name  , &"CUSTOM_MONSTERKILL" );
			eAttacker.hud_costumprint setText( &"CUSTOM_MONSTERKILL" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("monsterkill");}
			else eAttacker playLocalSound ("monsterkill");
		}
		
		if( eAttacker.KillsiRow == 12 ){
			iprintln ( eAttacker.name  , &"CUSTOM_MONSTERKILL" );
			eAttacker.hud_costumprint setText( &"CUSTOM_MONSTERKILL" );
		}
				
		if( eAttacker.KillsiRow == 13 ){
			iprintln ( eAttacker.name  , &"CUSTOM_HOLYSHIT" );
			eAttacker.hud_costumprint setText( &"CUSTOM_HOLYSHIT" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("holyshit");}
			else eAttacker playLocalSound ("holyshit");
		}
				
		if( eAttacker.KillsiRow == 14 ){
			iprintln ( eAttacker.name  , &"CUSTOM_HOLYSHIT" );
			eAttacker.hud_costumprint setText( &"CUSTOM_HOLYSHIT" );
		}
				
		if( eAttacker.KillsiRow == 15 ){
			iprintln ( eAttacker.name  , &"CUSTOM_SLAUGHTER" );
			eAttacker.hud_costumprint setText( &"CUSTOM_SLAUGHTER" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("slaughter");}
			else eAttacker playLocalSound ("slaughter");
		}
		
		if( eAttacker.KillsiRow == 16 ){
			iprintln ( eAttacker.name  , &"CUSTOM_SLAUGHTER" );
			eAttacker.hud_costumprint setText( &"CUSTOM_SLAUGHTER" );
		}

		if( eAttacker.KillsiRow == 17 ){
			iprintln ( eAttacker.name  , &"CUSTOM_UNSTOPABLE" );
			eAttacker.hud_costumprint setText( &"CUSTOM_UNSTOPABLE" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("unstoppable");}
			else eAttacker playLocalSound ("unstoppable");
		}

		if( eAttacker.KillsiRow == 18 ){
			iprintln ( eAttacker.name  , &"CUSTOM_UNSTOPABLE" );
			eAttacker.hud_costumprint setText( &"CUSTOM_UNSTOPABLE" );
		}
		
		if( eAttacker.KillsiRow >= 19 ){
			iprintln ( eAttacker.name  , &"CUSTOM_GODLIKE" );
			eAttacker.hud_costumprint setText( &"CUSTOM_GODLIKE" );
			
			if(eAttacker.headshot == 1 ){wait 1.5;eAttacker playLocalSound ("godlike");}
			else eAttacker playLocalSound ("godlike");
			
		}

		eAttacker.headshot = 0;		
	}
}

Timeannouncer(){

	shouldcount = true;
	color = (0,0,1);
	
	while( shouldcount ){
		sound = undefined;
		passedtime = (getTime() - level.starttime) / 1000;
		secondsleft = int((level.timelimit*60) - (passedtime));
		wait 1;

		if ( secondsleft < 5 ) shouldcount = false;
		
		if( level.mapended ) return;

		if( secondsleft > 300 ) continue;

		if ( secondsleft == 300 ){ 
			sound = "5min"; 
			color = (0,1,0);
		}
		
		if ( secondsleft == 120 ){ 
			sound = "2min"; 
			color = (0,1,1);
		}
		
		if ( secondsleft == 60 ){ 
			sound = "1min"; 
			color = (1,0,1);
		}
		
		if ( secondsleft == 30 ){ 
			sound = "30sec"; 
			color = (1,.5,0);
		}
		
		if ( secondsleft == 20 ){ 
			sound = "20sec";
			color = (1,1,0);
		}	
		if ( secondsleft == 10 ){ 
			sound = "10sec"; 
			color = (1,0,0);
		}
		
		if ( secondsleft == 5 )
			sound = "54321sec";
			
		if( isDefined (sound) ){
			level.clock.color = color;
			
			players = getentarray("player", "classname");
					
			for( i=0;i < players.size;i++ ){
				if( isplayer (players[i]) )
					players[i] playLocalSound (sound);
				}
		}
	}
}

CamperFurz(){
 
	// notify player and players
	self iprintlnbold( &"CUSTOM_CAMP1");
	
	iprintln( &"CUSTOM_CAMP2" );
	iprintln( self.name , &"CUSTOM_CAMP3");
		
	while( isPlayer(self) && isAlive(self) && isDefined(self.pers["camper"]) && isDefined(self.pers["team"]) && self.pers["team"] != "spectator" ){
			
		if(isPlayer(self)){
		
			playfxontag( game["fartbomb"], self, "pelvis" );
			self playLocalSound( "fart" );
		}
		
		wait randomInt(2) + 4;
	}
	
	time 	= 0;
	time = time + 0.2; 
		
	if(time >= game["am_indicate_end_after_sec"]){
		
		self thread maps\mp\gametypes\_admiral_mod_compass::DeleteCamping();
		self thread maps\mp\gametypes\_admiral_mod_player::CheckCamping();	
	}
}	

Bloodyscreen(){

	level endon("end_map");
	level endon("killed_player");
	self endon("spawned");
	self endon("disconnect");

	if(!isDefined(self.bloodonscreen)){
		
		self.bloodonscreen = newClientHudElem(self);
		self.bloodonscreen1 = newClientHudElem(self);
		self.bloodonscreen2 = newClientHudElem(self);
		self.bloodonscreen3 = newClientHudElem(self);

		self.bloodonscreen.alignX = "left";
		self.bloodonscreen.alignY = "top";
	
		self.bloodonscreen1.alignX = "left";
		self.bloodonscreen1.alignY = "top";

		self.bloodonscreen2.alignX = "left";
		self.bloodonscreen2.alignY = "top";
		
		self.bloodonscreen3.alignX = "left";
		self.bloodonscreen3.alignY = "top";
		
		bs1 = (randomint(496));
		bs2 = (randomint(336));
		bs1a = (randomint(496));
		bs2a = (randomint(336));
		bs1b = (randomint(496));
		bs2b = (randomint(336));
		bs1c = (randomint(496));
		bs2c = (randomint(336));

		self.bloodonscreen.x = bs1;
		self.bloodonscreen.y = bs2;

		self.bloodonscreen1.x = bs1a;
		self.bloodonscreen1.y = bs2a;

		self.bloodonscreen2.x = bs1b;
		self.bloodonscreen2.y = bs2b;

		self.bloodonscreen3.x = bs1c;
		self.bloodonscreen3.y = bs2c;

		bs3 = randomint(48);
		bs3a = randomint(48);
		bs3b = randomint(48);
		bs3c = randomint(48);
		
		self.bloodonscreen.color = (1,1,1);
		self.bloodonscreen1.color = (1,1,1);
		self.bloodonscreen2.color = (1,1,1);
		self.bloodonscreen3.color = (1,1,1);
		self.bloodonscreen.alpha = 1;
		self.bloodonscreen1.alpha = 1;
		self.bloodonscreen2.alpha = 1;
		self.bloodonscreen3.alpha = 1;

		self.bloodonscreen SetShader("gfx/impact/flesh_hit2",96 + bs3 , 96 + bs3);
		self.bloodonscreen1 SetShader("gfx/impact/flesh_hitgib",96 + bs3a , 96 + bs3a);
		self.bloodonscreen2 SetShader("gfx/impact/flesh_hit2",96 + bs3b , 96 + bs3b);
		self.bloodonscreen3 SetShader("gfx/impact/flesh_hitgib",96 + bs3c , 96 + bs3c);

		wait 4;

		if(!isDefined(self.bloodonscreen))	return;

		self.bloodonscreen fadeOverTime (2); 
		self.bloodonscreen.alpha = 0;
		self.bloodonscreen1 fadeOverTime (2);
		self.bloodonscreen1.alpha = 0;
		self.bloodonscreen2 fadeOverTime (2);
		self.bloodonscreen2.alpha = 0;
		self.bloodonscreen3 fadeOverTime (2);
		self.bloodonscreen3.alpha = 0;

		wait 2;

		if(!isDefined(self.bloodonscreen)) return;
		
		if(isDefined(self.bloodonscreen) || isDefined(self.bloodyscreen))
			self.bloodonscreen destroy();
 
		if(isDefined(self.bloodonscreen1) || isDefined(self.bloodyscreen)) 
			self.bloodonscreen1 destroy();
		
		if(isDefined(self.bloodonscreen2) || isDefined(self.bloodyscreen))
			self.bloodonscreen2 destroy();
 
		if(isDefined(self.bloodonscreen3) || isDefined(self.bloodyscreen))
	
		self.bloodonscreen3 destroy();
	}
}

BloodyscreenDestroy(){

	if(isDefined(self.bloodonscreen) || isDefined(self.bloodyscreen))
		self.bloodonscreen destroy();
 
	if(isDefined(self.bloodonscreen1) || isDefined(self.bloodyscreen)) 
		self.bloodonscreen1 destroy();
		
	if(isDefined(self.bloodonscreen2) || isDefined(self.bloodyscreen))
		self.bloodonscreen2 destroy();
 
	if(isDefined(self.bloodonscreen3) || isDefined(self.bloodyscreen))
		self.bloodonscreen3 destroy();
		
	self.bloodyscreen = 0;
}

Bulletholes(){

	self endon("disconnect");
	self endon("end_map");
	self endon("killed_player");
	self endon("spawned");

	if(!isDefined(self.bulletholes))
		self.bulletholes = [];

	hole = self.bulletholes.size;
	
	self.bulletholes[hole] = newClientHudElem(self);
	self.bulletholes[hole].alignX = "center";
	self.bulletholes[hole].alignY = "middle";
	self.bulletholes[hole].x = 48 + randomInt(544);
	self.bulletholes[hole].y = 48 + randomInt(304);
	self.bulletholes[hole].color = (1,1,1);
	self.bulletholes[hole].alpha = 0.8 + randomFloat(0.2);

	xsize = 64 + randomInt(32);
	ysize = 64 + randomInt(32);
	
	if(randomInt(2)) self.bulletholes[hole] setShader("gfx/custom/bullethit_glass.tga", xsize, ysize);
	else self.bulletholes[hole] setShader("gfx/custom/bullethit_glass2.tga", xsize, ysize);

	self playLocalSound("glass_break");

	wait 5;

	if(isPlayer(self)){
	
		if(isDefined(self.bulletholes)){
		
			if(isDefined(self.bulletholes[hole])){
			
				self.bulletholes[hole] fadeOverTime(1);
				self.bulletholes[hole].alpha = 0;
				
				wait 1;
				
				if(isPlayer(self) && isDefined(self.bulletholes[hole]))	
					self.bulletholes[hole] destroy();
			}
		}
	}
}

BulletholesDestroy(){

	if(isDefined(self.bulletholes)){
	
		for(i = 0; i < self.bulletholes.size; i++){
		
			if(isDefined(self.bulletholes[i]))
				self.bulletholes[i] destroy();
		}
	}
}
