Stopping a player from entering a console command

If I wanted a player to only be able to enter a console command ( and not have it return an error ) when a certain serverside convar was set, how would I do that? Is there a hook to call? Or do I have to have a timer running that checks each players clinetside convar and sets it back depending on a condition? I’d rather not do that. It seems hacky and inefficient.


–inside your concommand function do this (at the very top)
if !convar:GetBool() then return end


replace convar with your convar obviously

Basically if the user executes or tries to use the console command it checks for the convar, if its false then it doesn’t do anything, otherwise continues with the function.
Probably not the best way to do this but hey - it works.

Thanks! :slight_smile: worked just perfectly