• [LUA/SWEPS]TTT ,explosive awp Scope keeps zooming in on weapon switch
    4 replies, posted
Hello dear facepunch users so iam having the following problem: We're using the weapon weapon_mk_awp on our server so if you zoom in with it everything is fine but if you dont zoom out & just switch to another gun it keeps you zoomed in [without black "overlay] just a zoom. but if you do the same scenario with the rifle everything is fine can you help me with this since i have 0 clue in Sweps? :) [you can also help me via TeamViewer] [code]function SWEP:ShouldDropOnDie() return true end function SWEP:SetZoom(state) if CLIENT then return else if state then self.Owner:SetFOV(20, 0.3) else self.Owner:SetFOV(0, 0.2) end end end -- Add some zoom to ironsights for this gun function SWEP:SecondaryAttack() if not self.IronSightsPos then return end if self.Weapon:GetNextSecondaryFire() > CurTime() then return end bIronsights = not self:GetIronsights() self:SetIronsights( bIronsights ) if SERVER then self:SetZoom(bIronsights) else self:EmitSound(self.Secondary.Sound) end self.Weapon:SetNextSecondaryFire( CurTime() + 0.3) end function SWEP:PreDrop() self:SetZoom(false) self:SetIronsights(false) return self.BaseClass.PreDrop(self) end function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ); self:SetIronsights( false ) self:SetZoom(false) end function SWEP:Holster() self:SetIronsights(false) self:SetZoom(false) return true end[/code] PS: i did not write the code /swep whatever. :) mfg Alabama
Can you post the code for the weapon in lua tags please?
Add this in to your swep code. [CODE] function SWEP:Holster( wep ) self.Owner:SetFOV(0) end [/CODE]
[QUOTE=smithy285;50874679]Can you post the code for the weapon in lua tags please?[/QUOTE] sure let me do that real quick[EDIT: ok i did that do you need any more code of it?] [editline]13th August 2016[/editline] [QUOTE=Jiwer;50875167]Add this in to your swep code. [CODE] function SWEP:Holster( wep ) self.Owner:SetFOV(0) end [/CODE][/QUOTE] [code]function SWEP:PreDrop() self:SetZoom(false) self:SetIronsights(false) return self.BaseClass.PreDrop(self) end function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ); self:SetIronsights( false ) self:SetZoom(false) end function SWEP:Holster( wep ) self.Owner:SetFOV(0) end[/code] tried this (didnt seem to work ,gun wasnt even avaiable anymore) usually its supposed to be like this: [code]function SWEP:PreDrop() self:SetZoom(false) self:SetIronsights(false) return self.BaseClass.PreDrop(self) end function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ); self:SetIronsights( false ) self:SetZoom(false) end function SWEP:Holster() self:SetIronsights(false) self:SetZoom(false) return true end[/code]
bump
Sorry, you need to Log In to post a reply to this thread.