Garry's Mod Wiki

input.SetCursorPos

  input.SetCursorPos( number mouseX, number mouseY )

Description

Sets the cursor's position on the screen, relative to the topleft corner of the window

Arguments

1 number mouseX
X coordinate for mouse position
2 number mouseY
Y coordinate for mouse position

Example

Makes the user's cursor circle their screen

hook.Add( 'HUDPaint', 'CircleScreen', function() input.SetCursorPos( ScrW() / 2 + math.sin(CurTime()) * ScrW() / 2, ScrH() / 2 + math.cos(CurTime()) * ScrH() / 2 ) end)