Getting a players mouse position (Player.GetCurrentCommand?)

Okay, I’m trying to use **[Player.GetCurrentCommand

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.GetCurrentCommand)** to get when a player moves their mouse serverside, although it works fine anywhere clientside, serverside it seems to give this error when used:



] lua_run print( player.GetAll()[1]:GetCurrentCommand():GetMouseX() )
> print( player.GetAll()[1]:GetCurrentCommand():GetMouseX() )...
[@lua_run:1] Tried to use invalid object (type CUserCmd) (Object was NULL or not of the right type)


However it does seem to work when used in **[Gamemode.Move

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.Move)**, this worked fine on my listen server, however on my dedicated server everything was extremely laggy when done like this. Putting my movement code in a Think hook worked fine because I could use **[Player.KeyDown

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.KeyDown)**, and this didn’t lag, however due to the error above I can’t get a players mouse movement here.

Any suggestions on how I could do this without it lagging so much?

you could send gui.MousePos() to the server in think i guess.

just make sure you’ve enabled screenclicker

If you don’t mind me asking why do you need the clients mouse position on the server…?

http://img861.imageshack.us/img861/4535/gccmeloncopter.jpg

The orientation of the meloncopter is controlled by the mouse, like air vehicles are in most common games. You move your mouse down, the melons angles change so it moves down.

Using CUserCmd.GetMouseX doesn’t exactly return the position of a players mouse on the screen (sorry I just realised I could have worded the title of the thread better), it rather returns the change in mouse position sent in that command packet, which is exactly what I need.

A friend of mine has just pointed out a possible workaround for me though, I could just check for changes in player.GetAimVector?

You could check for changes in that yeah. cool looking copter though