I’m making a SWEP and I would like some help toggling the iron sights.
I found this code from an old swep pack but it does not work.
function SWEP:IronSight() if !self.Owner:KeyDown(IN_USE) then -- If the key E (Use Key) is not pressed, then if self.Owner:KeyPressed(IN_ATTACK2) then -- When the right click is pressed, then self.Owner:SetFOV( 65, 0.15 ) self:SetIronsights(true, self.Owner) -- Set the ironsight true if CLIENT then return end end end
Here’s the ironsight positions
SWEP.IronSightsPos = Vector (5.1489, -4.2492, 2.6844) SWEP.IronSightsAng = Vector (0.2289, 0.0109, 0)
The whole SWEP code is here:
Could someone show me the right code to toggle the iron sight with the “attack2” (usually right click) button?