Nothing special. Just a simple hotkey system I wrote a long time ago because F1-F4 didn’t provide me enough keys, and a gamemode I was working on required it for user simplicity.
Only reason I’m releasing is because I did a quick search of the Lua section for “hotkey” in thread titles, and I didn’t see any.
If someone already released a hotkey system, oh well.
Adding New Hotkeys:
To add a new hotkey, use the console command add_hotkey <command> <display>. Note that <command> MUST be a single word. Commands like impulse 101 will not work. Display can be as many words as you want. For example, if you wanted to add a suicide key, you could add it like so:
add_hotkey kill Commit Suicide
You can then open up your hotkey menu, assign a key to “Commit Suicide”, and use it to kill yourself.
If you added a hotkey you don’t want any more, or you made a typo in adding a hotkey, you can remove it by using the remove_hotkey . If we wanted to, for example, remove the suicide command we added above, we would use:
Put cl_hotkeys.lua in your lua/autorun/client/ folder. Make folders as necessary.
By default, “H” is assigned to bring up the hotkey menu. You can reassign this to any key you wish, other than bad hotkeys.
These hotkeys can not be used.
[ul][li]numbers 1-6 (not on the numpad), which are used for the weapons.
[/li][li]F1 to F4
All these are banned commands for very good reasons, usually being they would call infinitely, making your screen stuck at the “assign hotkey”, and forcing you to delete the hotkey text file and restart your Garry’s Mod to fix it.
Download from FileFront
Re-usage (For gamemodes, addons, etc)
I don’t care if you re-use this for your DarkRP edits, your Zombie Survival rehashes, your SpaceBuild version 7000, or whatever you want to use it for. I’m not going to be a jackass and Creative Commons License this, because it’s just a simple script written in twenty minutes to make my life and the life of my clients easier. If you’re going to use it, all I ask is you throw in a comment or two saying that I wrote it. Nothing more, nothing less.
You don’t even have to do that. It’s just polite to.