Im really noob at LUA but i need to know how to bind a key to open new addon. Any Help

could really help if you could make me a quick template :slight_smile:

F1 -
F2 -
F3 -
F4 -

These are hooks. Any functions hooked to them will be run when certain events happen in-game.
These hooks all determine what happens when someone presses one of these buttons.
The server handles these, so they have to be placed in server-side files, or autorun in the server folder.

Simple example:
[lua]hook.Add( “ShowSpare1”, “YourHookName”, function( ply )
ply:ConCommand( “ulx menu” )
end )[/lua]

These hooks all return the player that pressed the key, so you make them run the console command to open the ULX menu (as an example). Most addons should have a console command like this.

Thanks for that but is there anyway to add a different key like F5, F6 OR F7?

You could use : and here is a list with all the keys

In that case you’re better off using input.WasKeyPressed(), input.WasKeyReleased() or input.WasKeyTyped()

I’d recommend against using a specific key, unless you want to annoy users.

If the hooks Internet1001 gave you aren’t enough, you could also use the PlayerBindPress hook, or the KeyPress and KeyRelease hooks which use the IN_ enums.