sm_crh_immunity 0 //(0/1, default 0) Enable/disable admins being immune to restricting classes in TF2.
sm_crh_flags "b" //(default "b") Admin flags for immunity against restricting classes in TF2. So admins can use limited/blocked classes.
//They are still counted towards the limit. If multiple flags are provided, at least one has to be true. Cvar sm_crh_immunity has to be enabled.
sm_crh_classmenu 0 //Enables/disables the class menu popping up when you pick the wrong class.
sm_crh_sounds 0 //Enables/disables the Nope sound when you pick the wrong class.

Important info:
Plugin limits classes when humans spawn, so if you change limits after they have been spawned then you have to wait until they die or you can slay them (for changes to take effect). REMOVE AN OLDER VERSION OF THIS PLUGIN OR OTHER PLUGINS FOR CLASS RESTRICTION BEFORE INSTALLING THIS PLUGIN! Also, disable the tf2 default classlimit if enabled(the plugin disables this cvar but only once). Autobalance can also cause problems, depending on your settings.

Installation:
Autogenerates a .cfg file in cfg\sourcemod when you load it for the first time.

Download the plugin(or the source and compile it yourself)

Put the .smx file in tf\addons\sourcemod\plugins

Load the plugin manually/Change the map/Restart the server

Changelog:

9.12.2013 - 1.1 - Initial releaseChanges done to the original plugin:
- It ignores bots
- Autogenerated cfg file in tf/cfg/sourcemod folder
- Cvars were renamed to sm_crh_* to be shorter
- Check for max humans was added (so if you have more humans than limits, it will change scouts limit to unlimited)
- Added game check
10.12.2013 - 1.11 - Removed unnecessary code
- Optimized code a bit
21.4.2016 - 1.12 - Changed .wav sounds to .mp3
- Removed the print to all error messages
- Logging errors when there are more humans than cvars allow
- Added url to this thread
14.06.2016 - 2.00 - Reworked a big part of this plugin
- Config file is now called Class_Restrictions_For_Humans
- Added flag FCVAR_DONTRECORD for the version cvar so it doesnt appear in the config file
- Removed flag FCVAR_PLUGIN - deprecated
- Added cvars: sm_crh_text, sm_crh_sounds, sm_crh_classmenu
- The plugin will now inform the player that the class is full
- Cvar tf_classlimit is now being set to 0 so it doesnt break the plugin
- Reworked the functions that check whether there is space for a player
- Code optimizations
03.07.2016 - 2.10 - Transitional Syntax
- Removed convar change hook for tf_classlimit
- Changing m_lifeState when changing classes/teams
- Better code readability
- Modified version cvar flags
21.07.2016 - 2.11 - Changed handle type for convar handles to ConVar
05.04.2017 - 3.00 - Rewritten the third time
- Fixed a bug where players could change to a class that wasnt allowed
- The plugin now properly checks the number of players playing that class
- Removed sound files from being precached and added to the download table
- Code optimization and performance improvements
02.11.2017 - 3.01 - Replaced the game engine check