GetViewModelPosition not being called

Hello there, my problem is simple, I’ve got a SWEP base with the function GetViewModelPosition in order to make ironsights, but the function is not even getting called. I tried placing a ‘print’ but it just wont work.

Code for the base (here I have removed the ‘print’ debugging thing):




AddCSLuaFile()
----[[*
-- * Firearm weapon base
-- ]]

DEFINE_BASECLASS("sdk_base")

SWEP.PrintName			= "Firearm Base Weapon"
SWEP.Author				= "DyaMetR"
SWEP.Spawnable			= false

SWEP.ViewModel 			= "models/weapons/v_pistol.mdl"
SWEP.WorldModel 		= "models/weapons/w_pistol.mdl"
SWEP.HoldType 			= "pistol"
SWEP.ShowViewModel 		= true
SWEP.ShowWorldModel 		= true
SWEP.ViewModelFlip		= false
SWEP.TwoHanded			= false

SWEP.Primary.ClipSize	= 1
SWEP.Primary.DefaultClip= 0
SWEP.Primary.Ammo		= "none"
SWEP.Secondary.Ammo		= "none"

SWEP.Secondary.Automatic= false

SWEP.AmmoItem			= "" -- The item that the weapon uses as ammunition

SWEP.Damage				= 0
SWEP.Delay				= 0
SWEP.Cone				= 0
SWEP.Recoil				= 0

SWEP.IsReloading = false
SWEP.ReloadTime = 0

if SERVER then

	function SWEP:Deploy()
		
		self:SetNWFloat("cone",0)
		self:SetNWBool("aim", false)

		if self.TwoHanded and (self.Owner.Damage["LArm"][1] <= 0 or self.Owner.Damage["RArm"][1] <= 0) then

			SURVIVAL:SendHint(self.Owner, "You need both your arms to use this weapon")
			self.Owner:SelectWeapon(SURVIVAL.DefaultWeapon)

		end
		
		return true

	end
	
end

function SWEP:ShootEffects()

	self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
 	self.Owner:SetAnimation( PLAYER_ATTACK1 )
	
end

function SWEP:PrimaryAttack()
	
	if !self:CanPrimaryAttack() then return false end
	
	if self.Weapon:Clip1() > 0 and !self.IsReloading then
		
		if SERVER then
		
			local mul = 1
			
			if self:GetNWBool("aim") then
			
				mul = 0.3
			
			end
		
			--self:SetNWFloat("cone",(self.Cone * (0.3 - ((SURVIVAL:GetAbility(self.Owner, "Weapon use").lvl/SURVIVAL.MaxAbility)/4)) + (self.Owner:GetVelocity():Length()/1600)))
			self:SetNWFloat("cone", (0.02 + (self.Cone * (2 * (SURVIVAL:GetAbility(self.Owner, "Weapon use").lvl/SURVIVAL.MaxAbility)))*mul ) + (self.Owner:GetVelocity():Length()/1600))
			
		end
		
		local cone = self:GetNWFloat("cone")
		
		self:ShootEffects()
		self:ShootBullet(self.Damage,1,math.Clamp(cone,0.02,cone))
		
		if SERVER then
		
			local st = math.ceil(self.Recoil)
			local xp = math.ceil(self.Delay*10)
		
			if IsValid(self.Owner) then
		
				SURVIVAL:ImproveAbility(self.Owner,"Strength",st)
				SURVIVAL:ImproveAbility(self.Owner,"Weapon use",xp)
				
			end
			
		end
		
		self.Weapon:SetClip1(self.Weapon:Clip1() - 1)

		if SERVER then
			
			local mul = 1
		
			if self:GetNWBool("aim") then
			
				mul = 0.3
			
			end
		
			local eyeangle 	= self.Owner:EyeAngles()
			eyeangle.pitch 	= eyeangle.pitch - (self.Recoil*math.Clamp(SURVIVAL.MaxAbility/SURVIVAL:GetAbility(self.Owner, "Strength").lvl*mul,0,0.1))
			self.Owner:SetEyeAngles(eyeangle)
		
			self.Weapon:SetNextPrimaryFire(CurTime() + self.Delay*(1.5*(SURVIVAL:GetAbility(self.Owner,"Strength").lvl/SURVIVAL.MaxAbility)))
			
		end
		
	end
	

end

function SWEP:SecondaryAttack()
	
	if CLIENT then return end
	
	if SERVER then
	
		if self:GetNWBool("aim") then
		
			self:SetNWBool("aim", false)
			
		else
		
			self:SetNWBool("aim", true)
		
		end
		
	end

end

if SERVER then

	function SWEP:Reload()

		if (self.Owner.Damage["LArm"][1] <= 0 or self.Owner.Damage["RArm"][1] <= 0) then

			SURVIVAL:SendHint(self.Owner, "Another hand is needed to reload")

		else

			if !self.IsReloading and ( self.Owner.Inventory[self.AmmoItem] != nil ) and self.Owner:GetActiveWeapon():Clip1() < self.Primary.ClipSize then
		
				local seq = self.Weapon:SelectWeightedSequence(ACT_VM_RELOAD)
				local time = self.Weapon:SequenceDuration(seq)
		
				self:SendWeaponAnim( ACT_VM_RELOAD )
				self.Owner:SetAnimation( PLAYER_RELOAD )
			
				self.ReloadTime = CurTime() + time
			
				self.IsReloading = true
			
			end

		end

	end
	
	function SWEP:Think()
	
		if self.IsReloading and self.ReloadTime < CurTime() then
			
			if self.Owner.Inventory[self.AmmoItem] != nil then
			
				local resv = self.Owner.Inventory[self.AmmoItem]
				local clip = self.Owner:GetActiveWeapon():Clip1()
				local max = self.Primary.ClipSize
			
				self.Owner:GetActiveWeapon():SetClip1(math.Clamp(max, 0, clip + resv))
				SURVIVAL:RemoveInvItem(self.Owner, self.AmmoItem, math.Clamp(max - clip, 0, resv))
			
			end
			
			self:SendWeaponAnim( ACT_VM_IDLE )
			self.IsReloading = false
		
		end
	
	end
	
end

if CLIENT then

	local IRONSIGHT_TIME = 0.2

	function SWEP:GetViewModelPosition(oldPos, oldAng)

		local bIron = self:GetNWBool("aim")
		
		local pos = oldPos
		local ang = oldAng
		
		if (bIron != self.bLastIron) then
			self.bLastIron = bIron 
			self.fIronTime = CurTime()
			
			if (bIron) then 
				self.SwayScale 	= 0.3
				self.BobScale 	= 0.1
			else 
				self.SwayScale 	= 1.0
				self.BobScale 	= 1.0
			end
		
		end
		
		local fIronTime = self.fIronTime or 0

		if (!bIron && fIronTime < CurTime() - IRONSIGHT_TIME) then 
			return pos, ang
		end
		
		local Mul = 1.0
		
		if (fIronTime > CurTime() - IRONSIGHT_TIME) then
			Mul = math.Clamp((CurTime() - fIronTime) / IRONSIGHT_TIME, 0, 1)

			if (!bIron) then Mul = 1 - Mul end
		end

		if (self.IronSightsAng) then
			ang = ang * 1
			ang:RotateAroundAxis(ang:Right(), 	self.IronSightsAng.x * Mul)
			ang:RotateAroundAxis(ang:Up(), 	self.IronSightsAng.y * Mul)
			ang:RotateAroundAxis(ang:Forward(), self.IronSightsAng.z * Mul)
		end
		
		local Right 	= ang:Right()
		local Up 		= ang:Up()
		local Forward 	= ang:Forward()
		
		pos = pos + self.IronSightsPos.x * Right * Mul
		pos = pos + self.IronSightsPos.y * Forward * Mul
		pos = pos + self.IronSightsPos.z * Up * Mul
		
		return pos, ang
		
	end
	
end



I would like to know if anyone knows anything on the matter before I close the thread and find help elsewhere.

You cant just come here and ask for help within just a few hours and then be like ‘Oh move your asses and give me the solution or I’ll fuck off’ thats not actually nice, noone wants to help you if you’re a ass to them.

I waited 24 hours which is the normal time within posts are replied with anything. It’s not the first time I’ve been ignored. I just wanted to know if there was anything to do. I wasn’t asking anyone to move their asses, I just wanted a yes or no.

And also, that message was a way to bump the thread, so I don’t fall into oblivion so quickly.

no need to be salty