Console command on secondary attack

Hello everyone.
I’m making a swep and on secondary fire I need a console command to be “activated”
All help will be appreciated.
Thanks :3

Well is it a console command you’re defining yourself? Because if that’s the case you’re better off calling the function directly.

Otherwise use **[Player.ConCommand

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.ConCommand)**. But if you tell us what you want to do maybe we can find a better alternative.

I’m making a thermal scope with the MW2 Snipers.
I’m using this command: toggle_FLIR, I need that command to “activate” when you go into scope.

So this?

You could just rework it to be part of your swep, otherwise players will just be able to type the console command and have access to it anytime.

Yeah that’s it.

Any command with toggle in its name gets blocked as far as i know

You are incorrect.

Also you might not want to use the command. Just call the function directly when you use secondary fire.