• Why isn't my scope showing up?
    0 replies, posted
Im making a sniper but the scope material doesn't seem to show up. I've narrowed it down to that the hudDraw function doesn't get updated that IsScope is true. Here is most of my code.[lua]IsScoped = false SWEP.HoldType = "ar2" SWEP.Base = "weapon_cs_base" SWEP.Category = "Dave's Zombie Guns" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_snip_scout.mdl" SWEP.WorldModel = "models/weapons/w_snip_scout.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = true SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound( "weapons/scout/scout_fire-1.wav" ) SWEP.Primary.Recoil = 0.75 SWEP.Primary.Damage = 90 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.01 SWEP.Primary.ClipSize = 5 SWEP.Primary.Delay = 1 SWEP.Primary.DefaultClip = 25 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "xbowbolt" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" function SWEP:Precache() util.PrecacheSound( Sound( "weapons/scout/scout_fire-1.wav" ) ) end function SWEP:SecondaryAttack() if( !IsScoped) then if(SERVER) then self.Owner:SetFOV( 25, 0 ) end scope() IsScoped = true else if(SERVER) then self.Owner:SetFOV( 0, 0 ) end IsScoped=false end end function SWEP:Holster() if(SERVER) then self.Owner:SetFOV( 0, 0 ) end IsScoped = false return true end function SWEP:DrawHUD() Msg(IsScoped) if IsScoped then local QuadTable = {} QuadTable.texture = surface.GetTextureID( "overlays/scope_lens" ) QuadTable.color = Color( 255, 255, 255, 255) QuadTable.x = 0 QuadTable.y = 0 QuadTable.w = ScrW() QuadTable.h = ScrH() draw.TexturedQuad( QuadTable ) end end [/lua]
Sorry, you need to Log In to post a reply to this thread.