• Keybindings for a server.
    4 replies, posted
Hi there. So I'm looking for a way to bind keys serverside so users don't have to bind a key for the jukebox themselves. [CODE]hook.Add( "Think", "BM_Clients_Key", function() if input.IsKeyDown( KEY_1 ) then RunConsoleCommand("use","3d_maneuver_gear_expert_c") elseif input.IsKeyDown( KEY_2 ) then RunConsoleCommand("use","weapon_muskeblue") elseif input.IsKeyDown( KEY_F ) then RunConsoleCommand("use","aot_flaregun") end end )[/CODE] I found this on the forums but, when I used it spammed the command. Is there any way to make it so the command runs once when the user presses the key? Thanks in advance.
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/KeyPress]GM/KeyPress[/url]
[QUOTE=mib999;47735595][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/KeyPress]GM/KeyPress[/url][/QUOTE] Thanks for the link. :D Still don't quite understand how to implement it though :(
hook.Add( "KeyPress", "uniquehookidentifiernamehere", function( ply, key ) end );
[QUOTE=Busan1;47735960]hook.Add( "KeyPress", "uniquehookidentifiernamehere", function( ply, key ) end );[/QUOTE] Ah. I get it now. Thanks for the extra help man. :)
Sorry, you need to Log In to post a reply to this thread.