nextblast = 0

function onInit()
	_SWEPSetSound(MyIndex, "single_shot", "")
end

function onThink()
	if nextblast > 0 and _CurTime() > nextblast + 0.1 then
	if _swep.GetClipAmmo(MyIndex, 0) > 0 then
		_EntEmitSoundEx(Owner, "weapons/shotgun/shotgun_dbl_fire.wav", 0.9, 1.25)
		nextblast = _CurTime()
		for i=1, 2 do
			_TraceLine(_PlayerGetShootPos(Owner), vecAdd(_PlayerGetShootAng(Owner), vector3(math.random(-100, 100)*0.001, math.random(-100, 100)*0.001, math.random(-100, 100)*0.001)), 4064, Owner)
			if _TraceHitNonWorld() then
			local damage = getDamage()*0.5
			local tracedEntity = _TraceGetEnt()
			_RunString("_TraceAttack("..tracedEntity..", "..MyIndex..", "..Owner..", "..damage..")")
			end
			_EffectInit()
			_EffectSetEnt(Owner)
			_EffectSetOrigin( _TraceEndPos() )
			_EffectSetStart( _PlayerGetShootPos(Owner) )
			_EffectSetScale(1)
			_EffectSetMagnitude(3)
			_EffectSetRadius(7)
			_EffectDispatch("FadingLineTeam")
			if _TraceHit() then
				_MakeDecal(math.random(0,4))
			end
		end
		_SWEPUseAmmo(MyIndex, 0, 1)
	else
		nextblast = 0
	end
	end
end

function onPrimaryAttack()
	if _swep.GetClipAmmo(MyIndex, 0) > 0 then
		_EntEmitSoundEx(Owner, "weapons/usp/usp1.wav", 1, math.random(600,750)*0.001)
		_TraceLine(_PlayerGetShootPos(Owner), vecAdd(_PlayerGetShootAng(Owner), vector3(math.random(-25, 25)*0.001, math.random(-25, 25)*0.001, math.random(-25, 25)*0.001)), 4064, Owner)
		if _TraceHitNonWorld() then
			local damage = getDamage()
			local tracedEntity = _TraceGetEnt()
			_RunString("_TraceAttack("..tracedEntity..", "..MyIndex..", "..Owner..", "..damage..")")
		end
		_EffectInit()
		_EffectSetEnt(Owner)
		_EffectSetOrigin( _TraceEndPos() )
		_EffectSetStart( _PlayerGetShootPos(Owner) )
		_EffectSetScale(2)
		_EffectSetMagnitude(3)
		_EffectSetRadius(7)
		_EffectDispatch("FadingLine")
		if _TraceHit() then
			_MakeDecal(math.random(0,4))
		end
		_SWEPUseAmmo(MyIndex, 0, 1)
	end
end

function onSecondaryAttack()
	nextblast = _CurTime()
end

function onReload()
	nextblast = 0
	return true
end

function getWeaponSwapHands() end
function getWeaponFOV() return 74 end
function getWeaponSlot() return 1 end
function getWeaponSlotPos() return 5 end
function getFiresUnderwater() return true end
function getReloadsSingly() return false end
function getDamage() return math.random(21,24) end
function getPrimaryShotDelay() return 0.2 end
function getSecondaryShotDelay() return 6.0 end
function getPrimaryIsAutomatic() return false end
function getSecondaryIsAutomatic() return false end
function getPrimaryAmmoType() return "pistol" end
function getMaxClipPrimary() return 30 end
function getMaxClipSecondary() return -1 end
function getDefClipPrimary() return 9999 end
function getDefClipSecondary() return -1 end
function getPrimaryScriptOverride() return 2 end
function getSecondaryScriptOverride() return 3 end
function getBulletSpread() return vector3(0.025, 0.025, 0.025) end
function getViewKick() return vector3(0, 0.0, 0.0) end
function getViewKickRandom() return vector3( 0.8, 0.8, 0.8 ) end
function getViewModel() return "models/weapons/v_pist_elite.mdl" end
function getWorldModel() return "models/weapons/w_pist_elite.mdl" end
function getClassName()	return "gunlegend_duals" end
function getAnimPrefix() return "pistol" end
function getPrintName() return "Dual Battleaxe\n MK3 Specials" end
function getDeathIcon() return "d_deagle" end
