The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Lua Code
Posted by: Scrump | August 23, 2010 @ 4:32pm
Lua Code
[
Download
]
function SWEP:SecondaryAttack() local Zoomed = self.Weapon:GetNetworkedBool( "Ironsights" ) if (!Zoomed) then self:SetIronsights( true ) self.Owner:SetFOV( 20, 0.1 ) hook.Add( "HUDPaint", "HUDCrosshair", HUDCrosshair ) if CLIENT then self:EmitSound(Sound("weapons/sniper/sniper_zoomin.wav")) local function HUDCrosshair() client = client or LocalPlayer(); if( !client:Alive() ) then return nil; end local crosshair_x = ScrW() / 2; local crosshair_y = ScrH() / 2; local crosshair_size = 50; local crosshair_width = 1; surface.SetDrawColor( 0, 255, 0, 255 ) surface.DrawRect( crosshair_x - ( crosshair_size / 2 ), crosshair_y - ( crosshair_width / 2 ), crosshair_size, crosshair_width ); surface.DrawRect( crosshair_x - ( crosshair_width / 2 ), crosshair_y - ( crosshair_size / 2 ), crosshair_width, crosshair_size ); surface.DrawRect( crosshair_x - ( crosshair_size / 8 ), crosshair_y - ( crosshair_size / 3 ), crosshair_size / 4, crosshair_width ); surface.DrawRect( crosshair_x - ( crosshair_size / 8 ), crosshair_y + ( crosshair_size / 3 ) - crosshair_width, crosshair_size / 4, crosshair_width ); surface.DrawRect( crosshair_x - ( crosshair_size / 3 ), crosshair_y - ( crosshair_size / 8 ), crosshair_width, crosshair_size / 4 ); surface.DrawRect( crosshair_x + ( crosshair_size / 3 ) - crosshair_width, crosshair_y - ( crosshair_size / 8 ), crosshair_width, crosshair_size / 4 ); end end if SERVER then self.Owner:DrawViewModel(false) end else self:SetIronsights( false ) self.Owner:SetFOV( 0, 0.1 ) hook.Remove( "HUDPaint", "HUDCrosshair" ) if CLIENT then self:EmitSound(Sound("weapons/sniper/sniper_zoomin.wav")) end if SERVER then self.Owner:DrawViewModel(true) end end end
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.46 / 8
59 Votes
http://codebin.yi.org/804
page generated in 0.00 seconds