
// Variables that are used on both client and server

SWEP.Author		= ""
SWEP.Contact		= ""
SWEP.Purpose		= ""
SWEP.Instructions	= ""

SWEP.ViewModel		= "models/weapons/v_pistol.mdl"
SWEP.WorldModel		= "models/weapons/w_camphone.mdl"

util.PrecacheModel( SWEP.ViewModel )
util.PrecacheModel( SWEP.WorldModel )

SWEP.Primary.ClipSize		= -1
SWEP.Primary.DefaultClip	= -1
SWEP.Primary.Automatic		= false
SWEP.Primary.Ammo			= "none"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= true
SWEP.Secondary.Ammo			= "none"

SWEP.ShootSound				= "NPC_CScanner.TakePhoto"

SWEP.CameraZoom				= 80

/*---------------------------------------------------------
   Precache Stuff
---------------------------------------------------------*/
function SWEP:Precache()
	util.PrecacheSound( self.ShootSound )
end

/*---------------------------------------------------------
	Reload does nothing
---------------------------------------------------------*/
function SWEP:Reload()
end

/*---------------------------------------------------------
   Think does nothing
---------------------------------------------------------*/
function SWEP:Think()	
end

/*---------------------------------------------------------
   The effect when a weapon is fired successfully
---------------------------------------------------------*/
function SWEP:DoShootEffect()

	self.Weapon:EmitSound( self.ShootSound	)
	self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
	self.Owner:SetAnimation( PLAYER_ATTACK1 )
	
end



/*---------------------------------------------------------
	PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()

	self:DoShootEffect()
	
	// If we're multiplayer this can be done totally clientside
	if (!SinglePlayer() && SERVER) then return end
	
	self.Owner:ConCommand( "jpeg" )
	
end

/*---------------------------------------------------------
	SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()

	self.Weapon:SetNextPrimaryFire( CurTime() - 0.1 );

	if ( SERVER && !SinglePlayer() ) then return end

	local cmd = self.Owner:GetCurrentCommand()
	self.CameraZoom = math.Clamp( self.CameraZoom + cmd:GetMouseY() * 0.03, 1, 170 )

	
	// This function doesn't get called in singleplayer, so we need to tell the clientside
	// version of this script to update the FOV.
	if ( SERVER ) then
	
		self.Weapon:CallOnClient( "ForceFOV", tostring(self.CameraZoom) )
	
	end
	
end

if (SERVER) then

function SWEP:Deploy()

	self.Owner:DrawViewModel( false )

end

end
