• KeyPress for q key
    4 replies, posted
how do you make the key press function = the q key [code]function GM:KeyPress( ply, key ) if ( key == "qkey" ) then jDropW() end end[/code] what should i put to replace the "qkey"
If only would go to [url]http://wiki.garrysmod.com/page/GM/KeyPress[/url] and look for yourself... Then you'd know that there's nothing you can put instead of "qkey" because you can't hook onto all keys with GM:KeyPress.
[QUOTE=Robotboy655;47825202]If only would go to [url]http://wiki.garrysmod.com/page/GM/KeyPress[/url] and look for yourself... Then you'd know that there's nothing you can put instead of "qkey" because you can't hook onto all keys with GM:KeyPress.[/QUOTE] is there another funtion i can use that does the same thing i just want some thing for when a user hits the q key it does this thing
[QUOTE=Jenssons;47825272]is there another funtion i can use that does the same thing i just want some thing for when a user hits the q key it does this thing[/QUOTE] Pretty sure you'd have to use a clientside [URL="http://wiki.garrysmod.com/page/GM/Think"]think hook[/URL] combined with the [URL="http://wiki.garrysmod.com/page/Category:input"]input library[/URL] to use the [URL="http://wiki.garrysmod.com/page/Enums/KEY"]KEY enumerations[/URL]. The key enumerations are much larger in quantity than the IN enumerations, and you would use KEY_Q to replace the "qkey".
[url]http://wiki.garrysmod.com/page/GM/OnSpawnMenuOpen[/url] [url]http://wiki.garrysmod.com/page/GM/OnSpawnMenuClose[/url] These hooks are called by the +menu and -menu console commands, which are bound to Q by default. If you ever find yourself needing to listen for keys that aren't default shit like Q, use [url]http://wiki.garrysmod.com/page/GM/PlayerButtonUp[/url] and [url]http://wiki.garrysmod.com/page/GM/PlayerButtonDown[/url].
Sorry, you need to Log In to post a reply to this thread.