Gamemode.GUIMousePressed

From GMod Wiki

Revision as of 12:48, 12 March 2011 by Stan (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameGUIMousePressed
SyntaxGM:GUIMousePressed( MouseCode(MouseCode) mc, Vector AimVector )
DescriptionCalled when the player presses a mouse button (when the cursor is visible).
ReturnsNil
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.GUIMousePressed]Gamemode.GUIMousePressed [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]

Examples

function GM:GUIMousePressed(mc)
    if mc == MOUSE_LEFT then RunConsoleCommand("+attack")
    elseif mc == MOUSE_RIGHT then RunConsoleCommand("+attack2")
    end
end

Allows you to shoot when you press the mouse buttons when in GUI mode.

Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox