Note: cheats only work on a server you own or have admin rights on. You cannot switch them on in public matches.
1. From the main menu, open Options.
2. Select the Advanced tab.
3. Tick Enable Developer Console.
4. Press the ~ key (the default console key) to open the console, then type:
sv_cheats 1
Press Enter and the cheat commands become available. To turn them back off, type sv_cheats 0. Remember that using cheats on servers you don't control is against the rules and can get you banned.