_OpenScript( "includes/vector3.lua" );
myindex = 0;
owner = 0;
currenttime = 0;

function onInit()
		_SWEPSetSound( MyIndex, "single_shot", "Weapon_Crossbow.Single" )
end

function onThink()
end

function onPrimaryAttack()
	if (_PlayerInfo(Owner, "alive") == false) then return; end
	local arrow = _EntCreate( "prop_physics" );
	_EntPrecacheModel( "models/mixerman3d/other/arrow.mdl" );
	_EntSetModel(arrow, "models/mixerman3d/other/arrow.mdl");
	_EntSetPos(arrow, vecAdd(_PlayerGetShootPos(Owner),vector3(0,0,-12)))
	_EntSetAng(arrow, _PlayerGetShootAng(Owner));
	_EntSetOwner(arrow, Owner);
	local power = 900000;
	local fireforce = vecMul(_PlayerGetShootAng(Owner), vector3(power, power, power));
	_EntSpawn(arrow);
	_PhysApplyForce(arrow, fireforce);
	_SWEPUseAmmo(MyIndex, 0, 1);
end

function onSecondaryAttack()		
     
end

function onReload( )
	return true;
end

function getWeaponSwapHands()
	return true;	
end

function getWeaponFOV()
	return 80;	
end


function getWeaponSlot()
	return 5;	
end

function getWeaponSlotPos()
	return 3;	
end

function getFiresUnderwater()
	return true;
end

function getReloadsSingly()
	return true;
end

function getDamage()
	return 100;
end

function getPrimaryShotDelay()
	return 0.15;
end

function getSecondaryShotDelay()
	return 0.1;
end

function getPrimaryIsAutomatic()
	return true;
end

function getSecondaryIsAutomatic()
	return false;
end

function getPrimaryAmmoType()
	return "pistol";
end

function getSecondaryAmmoType()
	return "none";
end

function getMaxClipPrimary()
	return 1;
end

function getMaxClipSecondary()
	return -1;
end

function getDefClipPrimary()
	return 500;
end


function getDefClipSecondary()
	return -1;
end

function getPrimaryScriptOverride()
	return 2;
end

function getSecondaryScriptOverride()
	return 3;
end

function getBulletSpread()
	return vector3( 0.0, 0.0, 0.0 );
end

function getViewKick()
	return vector3( 0, 0.0, 0.0);
end

function getViewKickRandom()
	return vector3( 0.0, 0.0, 0.0 );
end

function getViewModel( )
	return "models/weapons/v_crossbow.mdl";
end

function getWorldModel( )
	return "models/weapons/w_crossbow.mdl";
end

function getClassName()
	return "weapon_crossbow";
end

-- pistol, smg, ar2, shotgun, rpg, phys, crossbow, melee, slam, grenade
function getAnimPrefix()
	return "smg";
end

function getPrintName()
	return "Slim's CrossBow";
end


      -- 0 = Don't override, shoot bullets, make sound and flash
	-- 1 = Don't shoot bullets but do make flash/sounds
	-- 2 = Only play animations
	-- 3 = Don't do anything
	
	function getPrimaryScriptOverride()
		return 0;
end

	function getSecondaryScriptOverride()
		return 3;
end


