-- ZS Sweeper Shotgun
-- Alternating | - line fire shotgun
-- JetBoom

temp = 0

	function onInit( )
		_SWEPSetSound( MyIndex, "single_shot", "" )
	end
function math.frandom(minn, maxn)
	minn = minn * 100
	maxn = maxn * 100
	return math.random(minn, maxn)*0.01
end
	function onPrimaryAttack()
		_EntEmitSound(MyIndex, "weapons/shotgun/shotgun_fire"..math.random(6,7)..".wav")
		if not _PlayerInfo(Owner, "alive") then return end
		local ang = _PlayerGetShootAng(Owner)
		if ang == nil then return end
		local ent = _EntCreate("crossbow_bolt")
		if ent > 0 then
			_EntSetOwner(ent, Owner)
			_EntSetKeyValue(ent, "damage", "20")
			local accuracy = 0.06
			local newang = vecAdd(ang, vector3(math.frandom(-accuracy, accuracy), math.frandom(-accuracy, accuracy), math.frandom(-accuracy, accuracy)))
			_EntSetPos(ent, _PlayerGetShootPos(Owner))
			_EntSetAng(ent, newang)
			_EntSetVelocity(ent, vecMul(newang, vector3(2200, 2200, 2200)))
			_EntSpawn(ent)
		end
	end
	
	function getWeaponSwapHands()
		return false
	end

	function getWeaponFOV()
		return 74
	end

	function getWeaponSlot()
		return 3
	end

	function getWeaponSlotPos()
		return 9
	end

	function getFiresUnderwater()
		return true
	end	

	function getReloadsSingly()
		return false
	end	

	function getDamage()
		return 12
	end

	function getPrimaryShotDelay()
		return 0.1
	end

	function getPrimaryIsAutomatic()
		return false
	end

	function getBulletSpread()
		return vector3( 0, 0, 0 )
	end

	function getNumShotsPrimary()
		return 1
	end

	function getViewKick()
		return vector3( -1.0, 0.0, 0.0)
	end

	function getViewKickRandom()
		return vector3( 0.0, 0.2, 0.5 )
	end

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

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

	function getClassName()
		return "weapon_crossshotgun"
	end

	function getPrimaryAmmoType()
		return "Buckshot"
	end

	function getSecondaryAmmoType()
		return "Buckshot"
	end

	function getMaxClipPrimary()
		return 8
	end

	function getMaxClipSecondary()
		return -1
	end

	function getDefClipPrimary()
		return 32
	end

	function getDefClipSecondary()
		return -1
	end

	function getAnimPrefix()
		return "shotgun"
	end

	function getPrintName()
		return "Sweeper Shotgun"
	end

	function getPrimaryScriptOverride()
		return 1
	end

	function getSecondaryScriptOverride()
		return 3
	end

	function getDeathIcon( )
		return "d_shotgun"
	end
