Sweps secondary as a function?

I want to make a swep thats secondary is a function and also scopes in. is this possible?

What do you mean?

well i want to make a swep that’s like an assault rifle with a night vision scope.

http://wiki.garrysmod.com/?title=SWEP.SecondaryAttack For the scope part.