Garry's Mod Wiki

input.WasMousePressed

  boolean input.WasMousePressed( number key )

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

1 number key
The key, see MOUSE enum

Returns

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

Example

Example usage

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