input.WasMousePressed

From Garry's Mod
Jump to: navigation, search
 input.WasMousePressed( )

Contents

Description

Returns whether a mouse key was initially pressed in the same frame this function was called.
If input.WasMouseDoublePressed returns true, this function will return false.

This function only works in Move hooks, and will detect mouse events even in main menu or when a typing in a text field.

Arguments

number key

The key, see MOUSE_ Enums

Returns

boolean

True if the mouse key was initially pressed the same frame that this function was called, false otherwise.

Examples

Example

Example usage

hook.Add( "CreateMove", "fafawefafwf", function()
	if ( input.WasMousePressed( MOUSE_LEFT ) ) then print( "Left mouse button was pressed" ) end
end )


Personal tools
Navigation