#include extreme\_ex_weapons;
knife()
{
	frw = undefined;
	for(;;)
	{
		wait.01;
		if(!isdefined(self)) 
			continue;
		current = self getcurrentweapon();
		if(isdefined(current) && current != "knife_mp") continue;
		
		if(isdefined(self) && !self attackbuttonpressed()) frw = undefined;
		
		if(isdefined(self) && self attackbuttonpressed() && !isdefined(frw))
		{
			frw = true;
			knf = spawn("script_model", (0,0,0));
			knf.origin = self.ex_thumbmarker.origin;
			knf setModel("xmodel/weapon_knife");
			knf.angles = self.angles;
			knf show();
			startOrigin = self getEye();
			forward = anglesToForward(self getplayerangles());
			forward = [[level.ex_vectorscale]]( forward, 500 );  // Effective range
			endOrigin = startOrigin + forward;
			knf moveto(endOrigin,.3,0,0);  // Speed the knife moves
			knf rotatepitch(360,.6,0,0);
			wait .6;
			knf delete();
		}
	}
}