Gamemode.KeyRelease

From GMod Wiki

Revision as of 12:59, 4 December 2010 by SiPlus (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameKeyRelease
SyntaxGM:KeyRelease( Player player, IN_KEYS(IN_KEYS) key )
DescriptionRuns when a key has been released.
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.KeyRelease]Gamemode.KeyRelease [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionMessage to the console whenever a player releases a key.
Used onNewerShared.png
Code
local function printKeyReleased( ply, key )
	print( ply:GetName() .. " released " .. key )
end
 
hook.Add( "KeyRelease", "KeyReleasedHook", printKeyReleased )
OutputWhen a player releases a key the console receives the information on the key release.


Additional notes

They key returned is shown as an integer. Check the IN_KEYS to see what the int corresponds to in actions terms. Example: (1, being IN_ATTACK, defaulting to left-click)

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox