M9K Ironsights help..

(First thread! Be kind :slight_smile: If I’m posting in the wrong section, apologies)
Hello everyone! I’m trying to make a swep with the M9K base, but the ironsights just won’t work. It’s my very first swep tho. Here’s the swep code…


-- Variables that are used on both client and server
SWEP.Gun = ("aplayer_aks74") -- must be the name of your swep but NO CAPITALS!
SWEP.Category				= "Aplayer's Weapons" --Category where you will find your weapons
SWEP.Author				= "Aplayer"
SWEP.Contact				= "Nope ;)"
SWEP.Purpose				= "To kill people!"
SWEP.Instructions				= "Mouse1 to shoot, mouse2 to aim down sights."
SWEP.PrintName				= "AKS-74"		-- Weapon name (Shown on HUD)	
SWEP.Slot				= 2				-- Slot in the weapon selection menu
SWEP.SlotPos				= 1			-- Position in the slot
SWEP.DrawAmmo				= true		-- Should draw the default HL2 ammo counter
SWEP.DrawWeaponInfoBox		= true		-- Should draw the weapon info box
SWEP.BounceWeaponIcon   	= false  	-- Should the weapon icon bounce?
SWEP.DrawCrosshair			= false		-- set false if you want no crosshair
SWEP.Weight					= 30		-- rank relative ot other weapons. bigger is better
SWEP.AutoSwitchTo			= true		-- Auto switch to if we pick it up
SWEP.AutoSwitchFrom			= true		-- Auto switch from if you pick up a better weapon
SWEP.HoldType 				= "ar2"		-- how others view you carrying the weapon
-- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive 
-- you're mostly going to use ar2, smg, shotgun or pistol. rpg makes for good sniper rifles

SWEP.ViewModelFOV			= 70
SWEP.ViewModelFlip			= false
SWEP.ViewModel				= "models/weapons/v_lel_idfk.mdl"	-- Weapon view model
SWEP.WorldModel				= "models/weapons/.mdl"	-- Weapon world model
SWEP.ShowWorldModel			= false
SWEP.Base				= "testweapon_gun_base" --the Base this weapon will work on. PLEASE RENAME THE BASE! 
SWEP.Spawnable				= true
SWEP.AdminSpawnable			= true
SWEP.FiresUnderwater = false

SWEP.Primary.Sound			= Sound("test_gun_shot")		-- Script that calls the primary fire sound
SWEP.Primary.SilencedSound 	= Sound("")		-- Sound if the weapon is silenced
SWEP.Primary.RPM			= 650			-- This is in Rounds Per Minute
SWEP.Primary.ClipSize			= 30		-- Size of a clip
SWEP.Primary.DefaultClip		= 120		-- Bullets you start with
SWEP.Primary.KickUp				= 1 		-- Maximum up recoil (rise)
SWEP.Primary.KickDown			= 0.5		-- Maximum down recoil (skeet)
SWEP.Primary.KickHorizontal		= 0.5		-- Maximum up recoil (stock)
SWEP.Primary.Automatic			= true		-- Automatic = true; Semi Auto = false
SWEP.Primary.Ammo			= "ar2"			-- pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, AirboatGun
-- Pistol, buckshot, and slam always ricochet. 
--Use AirboatGun for a light metal peircing shotgun pellets
SWEP.SelectiveFire		= true
SWEP.CanBeSilenced		= false

SWEP.Secondary.IronFOV			= 55		-- How much you 'zoom' in. Less is more! 	

SWEP.data 				= {}				--The starting firemode
SWEP.data.ironsights			= 1

SWEP.Primary.Damage		= 40	-- Base damage per bullet
SWEP.Primary.Spread		= .03	-- Define from-the-hip accuracy 1 is terrible, .0001 is exact)
SWEP.Primary.IronAccuracy = 0.001 -- Ironsight accuracy, should be the same for shotguns

-- Enter iron sight info and bone mod info below
SWEP.IronSightsPos = Vector(-2.508, -5.165, 0.6)
SWEP.IronSightsAng = Vector(0.165, -0.065, 0)
SWEP.RunSightsPos = Vector(8.253, -9.54, -7.159)
SWEP.RunSightsAng = Vector(-4.2, 70, -17.748)
SWEP.WElements = {
	["gun"] = { type = "Model", model = "models/weapons/w_lel_idfk.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.878, 1.592, 2.016), angle = Angle(-10.603, 1.3, 180), size = Vector(0.009, 0.009, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}

Well, that’s the code. I won’t be posting images becuase I don’t think they’re really necessary. Basically, what happens is if I aim down the sights, it will just zoom in. No sights, just zoom in. HELP.
If you REALLY need a screenshot, let me know.

Anyone? -.-

How do you even screw this up?
But to answer the topic at hand, what exactly does SWEP.data.ironsights even do?

SWEP.Secondary.IronFOV = 55

Try changing that 55 to 64, it might just be that you zoom in to far to see the iron sight animation.

No no no he probably has the ironsights set to go to the middle of the screen, where you’d still be able to actually see them

Maybe we do need screenshots aft-
Hang on a tick.

That isn’t the M9K swep base…

Anyway, I think screenshots are in order.

I think it is the M9k SWEP Base; one time I browsed Bob’s website and found that he actually released a SWEP template kit, and one of his guides was called “Renaming your base” (Presumably to prevent interference with the main M9K)

Ehh, I dunno. I don’t even know Lua. I was trying to make a Swep by following the tutorials by Bob. I dunno why it doesn’t work, I asked everywhere D:

[editline]28th November 2013[/editline]

(I try everything even if some other people don’t agree)
Tried, didn’t work :frowning:

If you don’t know lua, I would not reccomend starting out with the M9K base. Try something a little more simple, as for your error, can you post the Secondary Attack code?

He doesn’t have secondary attack code; it’s the template from M9k. just a collection of vars.

M9K is the simpliest base I found so far. That’s why I’m using it. Look at Customizable Weaponry. THAT’S advanced and there’s no base download for it >.<

Uh, yes there is. And it’s very simple to use, just a bit more complicated than M9k to set up.

Are you trying to import to TTT server?

Yes there is? It comes with the weapons and is really easy to use and modify. M9K is just a simple weapon base with sprinting animations; there’s nothing to it.

And a cool muzzle break effect that by some lapse in reasoning is applied to tiny handguns :v: