Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SWEP:SecondaryAttack()
- if self:GetNWBool("Scoped") then
- self.Weapon:SetNWBool("Scoped", false)
- self.Owner:GetViewModel():SetNoDraw(false)
- self.Owner:SetFOV( 0, 0.25 )
- self:AdjustMouseSensitivity()
- elseif not self:GetNWBool("Scoped") then
- self.Weapon:SetNWBool("Scoped", true)
- self.Owner:GetViewModel():SetNoDraw(true)
- self.Owner:SetFOV( 10, 0.25 )
- self:AdjustMouseSensitivity()
- end
- end
- function SWEP:AdjustMouseSensitivity()
- if self:GetNWBool("Scoped") then
- return 0.25
- else if not self:GetNWBool("Scoped") then
- return -1
- end
- end
- end
- function SWEP:DrawHUD()
- if (CLIENT) then
- if not self:GetNWBool("Scoped") then
- local x, y
- if ( self.Owner == LocalPlayer() && self.Owner:ShouldDrawLocalPlayer() ) then
- local tr = util.GetPlayerTrace( self.Owner )
- // tr.mask = ( CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE|CONTENTS_AUX )
- local trace = util.TraceLine( tr )
- local coords = trace.HitPos:ToScreen()
- x, y = coords.x, coords.y
- else
- x, y = ScrW() / 2.0, ScrH() / 2.0
- end
- local scale = 10 * self.Primary.Cone
- local LastShootTime = self.Weapon:GetNetworkedFloat( "LastShootTime", 0 )
- scale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 ))
- surface.SetDrawColor( 255, 0, 0, 255 )
- local gap = 40 * scale
- local length = gap + 20 * scale
- surface.DrawLine( x - length, y, x - gap, y )
- surface.DrawLine( x + length, y, x + gap, y )
- surface.DrawLine( x, y - length, x, y - gap )
- surface.DrawLine( x, y + length, x, y + gap )
- return;
- end
- local Scale = ScrH()/480
- local w, h = 320*Scale, 240*Scale
- local cx, cy = ScrW()/2, ScrH()/2
- local scope_sniper_lr = surface.GetTextureID("sprites/scopes/752/scope_synbf3_lr")
- local scope_sniper_ll = surface.GetTextureID("sprites/scopes/752/scope_synbf3_ll")
- local scope_sniper_ul = surface.GetTextureID("sprites/scopes/752/scope_synbf3_ul")
- local scope_sniper_ur = surface.GetTextureID("sprites/scopes/752/scope_synbf3_ur")
- local SNIPERSCOPE_MIN = -0.75
- local SNIPERSCOPE_MAX = -2.782
- local SNIPERSCOPE_SCALE = 0.4
- local x = ScrW() / 2.0
- local y = ScrH() / 2.0
- surface.SetDrawColor( 0, 0, 0, 255 )
- local gap = 0
- local length = gap + 9999
- surface.SetDrawColor( 0, 0, 0, 255 )
- surface.DrawLine( x - length, y, x - gap, y )
- surface.DrawLine( x + length, y, x + gap, y )
- surface.DrawLine( x, y - length, x, y - gap )
- surface.DrawLine( x, y + length, x, y + gap )
- render.UpdateRefractTexture()
- surface.SetDrawColor(255, 255, 255, 255)
- surface.SetTexture(scope_sniper_lr)
- surface.DrawTexturedRect(cx, cy, w, h)
- surface.SetTexture(scope_sniper_ll)
- surface.DrawTexturedRect(cx-w, cy, w, h)
- surface.SetTexture(scope_sniper_ul)
- surface.DrawTexturedRect(cx-w, cy-h, w, h)
- surface.SetTexture(scope_sniper_ur)
- surface.DrawTexturedRect(cx, cy-h, w, h)
- surface.SetDrawColor(0, 0, 0, 255)
- if cx-w > 0 then
- surface.DrawRect(0, 0, cx-w, ScrH())
- surface.DrawRect(cx+w, 0, cx-w, ScrH())
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement