Code | /*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
//The variable "ScopeLevel" tells how far the scope has zoomed.
//This SWEP has 2 zoom levels.
if(ScopeLevel == 0) then
if(SERVER) then
self.Owner:SetFOV( 45, 0 )
//SetFOV changes the field of view, or zoom. First argument is the
//number of degrees in the player's view (lower numbers zoom farther,)
//and the second is the duration it takes in seconds.
end
ScopeLevel = 1
//This is zoom level 1.
else if(ScopeLevel == 1) then
if(SERVER) then
self.Owner:SetFOV( 25, 0 )
end
ScopeLevel = 2
//This is zoom level 2.
else
//If the user is zoomed in all the way, reset their view.
if(SERVER) then
self.Owner:SetFOV( 0, 0 )
//Setting the FOV to zero resets the player's view, AFAIK
end
ScopeLevel = 0
//There is no zoom.
end
end
end |