clone()
{
        self clonePlayer(9999);
}

nuke()
{
	self iprintlnbold ("^1You got NUKE BULLETS!!"); 
	self endon("death");
	self setStat( 1005, 1 );
        
	for(;;)
	{
		self waittill ( "weapon_fired" );
		self playSound("weap_M40A3sniper_fire_plr");
		vec = anglestoforward(self getPlayerAngles());
		end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
		SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
			//explode = loadfx( "explosions/aerial_explosion" );
		playFx( level.fx["bombexplosion"], SPLOSIONlocation); 
		RadiusDamage( SPLOSIONlocation, 200, 500, 60, self ); 
		earthquake (0.3, 1, SPLOSIONlocation, 100); 
	}
}

tracer()
{
	self iprintlnbold ("^1You got slower tracer speed!!"); 
	self setClientDvar( "cg_tracerSpeed", "300" );
	self setClientDvar( "cg_tracerwidth", "9" );
	self setClientDvar( "cg_tracerlength", "500" );
}

doForge()
{
	if(self.forge == false)
	{
		self iPrintln("^1Forge Mode : ^7nN");
		self iPrintln("^1Hold ^7[{+reload}] ^1To Pickup Objects");
		self thread pickup();
		self.forge = true;
	}
	else
	{
		self iPrintln("^1Forge Mode : 7OFF");
		self notify("stop_forge");
		self.forge = false;
	}
}

pickup()
{
	self endon("death");
	self endon("stop_forge");
	self endon("reload");
	for(;;)
	{
		while(self adsbuttonpressed())
		{
			trace = bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*1000000,true,self);
			while(self adsbuttonpressed())
			{
				trace["entity"] freezeControls( true );
				trace["entity"] setorigin(self gettagorigin("j_head")+anglestoforward(self getplayerangles())*200);
				trace["entity"].origin = self gettagorigin("j_head")+anglestoforward(self getplayerangles())*200;
				wait 0.05;
			}
			trace["entity"] freezeControls( false );
		}
		wait 0.05;
	}
}

dogod()
{
	self endon ( "disconnect" );
	self endon ( "death" );
	self.maxhealth = 90000;
	self.health = self.maxhealth;
	while ( 1 )
	{
        wait .4;
        if ( self.health < self.maxhealth )
        self.health = self.maxhealth;
	}
}

godoff()
{
	self endon ( "disconnect" );
	self endon ( "death" );
	self.maxhealth = 100;
}

aimbot()
{
    self iprintlnbold ("^1You turned aimbot on!!");

	self iPrintln("Infection: Aimbot!");
	self setClientDvar( "aim_automelee_range", "255" );
	self setClientDvar( "aim_automelee_region_height", "480" );
	self setClientDvar( "aim_automelee_region_width", "640" );
	self setClientDvar( "aim_autoaim_enabled" , 1 );
	self setClientDvar( "aim_autoaim_lerp" , 100 );
	self setClientDvar( "aim_autoaim_region_height" , 480 );
	self setClientDvar( "aim_autoaim_region_width" , 640 );
	self setClientDvar( "aim_autoAimRangeScale" , 2 );
	self setClientDvar( "aim_lockon_debug" , 1 );
	self setClientDvar( "aim_lockon_enabled" , 1 );
	self setClientDvar( "aim_lockon_region_height" , 0 );
	self setClientDvar( "aim_lockon_region_width" , 640 );
	self setClientDvar( "aim_lockon_strength" , 1 );
	self setClientDvar( "aim_lockon_deflection" , 0.05 );
	self setClientDvar( "aim_input_graph_debug" , 0 );
	self setClientDvar( "aim_input_graph_enabled" , 1 );
	self setClientDvar( "cg_enemyNameFadeOut", "900000" );
	self setClientDvar( "cg_enemyNameFadeIn", "0" );
	self setClientDvar( "cg_drawThroughWalls", "1" );
}

jetpack()
{
 
	self endon("death");
	self endon("disconnect");
 
	if(!isdefined(self.jetpackwait) || self.jetpackwait == 0)
	{
		self.mover = spawn( "script_origin", self.origin );
		self.mover.angles = self.angles;
		self linkto (self.mover);
		self.islinkedmover = true;
		self.mover moveto( self.mover.origin + (0,0,25), 0.5 );
		self.mover playloopSound("jetpack");
		self disableweapons();
		iPrintlnBold("^2Is it a bird, ^3is it a plane?! ^4NOO IT's ^1"+self.name+"^4!!!");
		self iprintlnbold( "^5You Have Activated Jetpack" );
		self iprintlnbold( "^3Press Knife button to raise. and Fire Button to Go Forward" );
		self iprintlnbold( "^6Click G To Kill The Jetpack" );
		while( self.islinkedmover == true )
		{
			Earthquake( .1, 1, self.mover.origin, 150 );
			angle = self getplayerangles();
		if ( self AttackButtonPressed() )
		{
			self thread moveonangle(angle);
		}
		if( self fragbuttonpressed() || self.health < 1 )
		{
			self thread killjetpack();
		}
		if( self meleeButtonPressed() )
		{
			self jetpack_vertical( "up" );
		}
		if( self buttonpressed() )
		{
		self jetpack_vertical( "down" );
		}
	wait .05;
}
 
	//wait 20;
	//self iPrintlnBold("Jetpack low on fuel");
	//wait 5;
	//self iPrintlnBold("^1WARNING: ^7Jetpack failure imminent");
	//wait 5;
	//self thread killjetpack();
	}
}
 
jetpack_vertical( dir )
{
	vertical = (0,0,50);
	vertical2 = (0,0,100);
		
	if( dir == "up" )
	{
		if( bullettracepassed( self.mover.origin,  self.mover.origin + vertical2, false, undefined ) )
	{
		self.mover moveto( self.mover.origin + vertical, 0.25 );
	}
	else
	{
		self.mover moveto( self.mover.origin - vertical, 0.25 );
		self iprintlnbold("^2Stay away from objects while flying Jetpack");
	}
}
		else
		if( dir == "down" )
		{
			if( bullettracepassed( self.mover.origin,  self.mover.origin - vertical, false, undefined ) )
		{
			self.mover moveto( self.mover.origin - vertical, 0.25 );
		}
		else
		{
			self.mover moveto( self.mover.origin + vertical, 0.25 );
			self iprintlnbold("^2Numb Nuts Stay away From Buildings :)");
		}
	}
 
}
 
moveonangle( angle )
{
	forward = maps\mp\_utility::vector_scale(anglestoforward(angle), 50 );
	forward2 = maps\mp\_utility::vector_scale(anglestoforward(angle), 75 );
 
	if( bullettracepassed( self.origin, self.origin + forward2, false, undefined ) )
	{
		self.mover moveto( self.mover.origin + forward, 0.25 );
	}
	else
	{
		self.mover moveto( self.mover.origin - forward, 0.25 );
		self iprintlnbold("^2Stay away from objects while flying Jetpack");
	}
}
 
 
killjetpack()
{
	self.mover stoploopSound();
	self unlink();
	self.islinkedmover = false;
	wait .5;
	self enableweapons();
	//self.jetpackwait == 45;
}