C# Class GarrysModLuaShared.Classes.CUserCmd

A class used to store the player inputs, such as mouse movement, view angles, IN buttons pressed and analog movement, the data from this class is then transfered to a CMoveData during actual movement simulation. Can be modified during CreateMove, StartCommand hook and used in read only with SetupMove hook and Player.GetCurrentCommand.
Inheritance: LuaObject
Exibir arquivo Open project: OmegaExtern/gmod-csharp-binary-module

Public Methods

Method Description
CUserCmd ( int index ) : GarrysModLuaShared.Enums
ClearButtons ( ) : void

Removes all keys from the command. Doesn't prevent movement, see ClearMovement for this.

ClearMovement ( ) : void

Clears the movement from the command.

CommandNumber ( ) : double

Returns an increasing number representing the index of the user cmd. The value returned is occasionally 0 inside CreateMove hook, so it's advised to check for a non-zero value if you wish to get the correct number.

GetButtons ( ) : IN

Returns a bitflag indicating which buttons are pressed.

GetForwardMove ( ) : double

The speed the client wishes to move forward with, negative if the clients wants to move backwards.

GetImpulse ( ) : double

Gets the current impulse from the client, usually 0.

GetMouseWheel ( ) : double

Returns the scroll delta as whole number.

GetMouseX ( ) : int

Returns the delta of the angular horizontal mouse movement of the player.

GetMouseY ( ) : int

Returns the delta of the angular vertical mouse movement of the player.

GetSideMove ( ) : double

The speed the client wishes to move sideways with, positive if it wants to move right, negative if it wants to move left.

GetUpMove ( ) : double

The speed the client wishes to move up with, negative if the clients wants to move down.

GetViewAngles ( ) : Angle

Gets the direction the client wants to move in.

KeyDown ( IN key ) : bool

Returns true if the specified button(s) is pressed.

RemoveKey ( IN button ) : void

Removed a key bit from the current key bitflag.

SelectWeapon ( Weapon weapon ) : void

Forces the associated player to select a weapon. This is used internally in the default HL2 weapon selection HUD. NOTE: Due to a bug, you will have to force this function to run until Player.GetActiveWeapon returns the chosen weapon, although it is also advised to add a time limit in case the switch fails for any reason. NOTE 2: This is the ideal function to use to create a custom weapon selection HUD, as it allows prediction to run properly for WEAPON.Deploy hook and PlayerSwitchWeapon hook.

SetButtons ( IN buttons ) : void

Sets the buttons bitflag.

SetForwardMove ( double speed ) : void

Sets speed the client wishes to move forward with, negative if the clients wants to move backwards.

SetImpulse ( double impulse ) : void

Sets the impulse to be send together with the command.

SetMouseWheel ( double delta ) : void

Sets the scroll delta.

SetMouseX ( int x ) : void

Sets the delta of the angular horizontal mouse movement of the player.

SetMouseY ( int y ) : void

Sets the delta of the angular vertical mouse movement of the player.

SetSideMove ( double speed ) : void

Sets speed the client wishes to move sidewards with, positive to move right, negative to move left.

SetUpMove ( double speed ) : void

Sets speed the client wishes to move upwards with, negative to move down.

SetViewAngles ( Angle viewAngle ) : void

Sets the direction the client wants to move in.

TickCount ( ) : double

Returns tick count since joining the server. Sometimes returns 0.

Method Details

CUserCmd() public method

public CUserCmd ( int index ) : GarrysModLuaShared.Enums
index int
return GarrysModLuaShared.Enums

ClearButtons() public method

Removes all keys from the command. Doesn't prevent movement, see ClearMovement for this.
public ClearButtons ( ) : void
return void

ClearMovement() public method

Clears the movement from the command.
public ClearMovement ( ) : void
return void

CommandNumber() public method

Returns an increasing number representing the index of the user cmd. The value returned is occasionally 0 inside CreateMove hook, so it's advised to check for a non-zero value if you wish to get the correct number.
public CommandNumber ( ) : double
return double

GetButtons() public method

Returns a bitflag indicating which buttons are pressed.
public GetButtons ( ) : IN
return IN

GetForwardMove() public method

The speed the client wishes to move forward with, negative if the clients wants to move backwards.
public GetForwardMove ( ) : double
return double

GetImpulse() public method

Gets the current impulse from the client, usually 0.
public GetImpulse ( ) : double
return double

GetMouseWheel() public method

Returns the scroll delta as whole number.
public GetMouseWheel ( ) : double
return double

GetMouseX() public method

Returns the delta of the angular horizontal mouse movement of the player.
public GetMouseX ( ) : int
return int

GetMouseY() public method

Returns the delta of the angular vertical mouse movement of the player.
public GetMouseY ( ) : int
return int

GetSideMove() public method

The speed the client wishes to move sideways with, positive if it wants to move right, negative if it wants to move left.
public GetSideMove ( ) : double
return double

GetUpMove() public method

The speed the client wishes to move up with, negative if the clients wants to move down.
public GetUpMove ( ) : double
return double

GetViewAngles() public method

Gets the direction the client wants to move in.
public GetViewAngles ( ) : Angle
return Angle

KeyDown() public method

Returns true if the specified button(s) is pressed.
public KeyDown ( IN key ) : bool
key IN Bitflag representing which button to check.
return bool

RemoveKey() public method

Removed a key bit from the current key bitflag.
public RemoveKey ( IN button ) : void
button IN Bitflag to be removed from the key bitflag.
return void

SelectWeapon() public method

Forces the associated player to select a weapon. This is used internally in the default HL2 weapon selection HUD. NOTE: Due to a bug, you will have to force this function to run until Player.GetActiveWeapon returns the chosen weapon, although it is also advised to add a time limit in case the switch fails for any reason. NOTE 2: This is the ideal function to use to create a custom weapon selection HUD, as it allows prediction to run properly for WEAPON.Deploy hook and PlayerSwitchWeapon hook.
public SelectWeapon ( Weapon weapon ) : void
weapon Weapon The weapon entity to select.
return void

SetButtons() public method

Sets the buttons bitflag.
public SetButtons ( IN buttons ) : void
buttons IN Bitflag representing which buttons are "down".
return void

SetForwardMove() public method

Sets speed the client wishes to move forward with, negative if the clients wants to move backwards.
public SetForwardMove ( double speed ) : void
speed double The new speed to request.
return void

SetImpulse() public method

Sets the impulse to be send together with the command.
public SetImpulse ( double impulse ) : void
impulse double The impulse to send.
return void

SetMouseWheel() public method

Sets the scroll delta.
public SetMouseWheel ( double delta ) : void
delta double The scroll delta.
return void

SetMouseX() public method

Sets the delta of the angular horizontal mouse movement of the player.
public SetMouseX ( int x ) : void
x int Angular horizontal move delta.
return void

SetMouseY() public method

Sets the delta of the angular vertical mouse movement of the player.
public SetMouseY ( int y ) : void
y int Angular vertical move delta.
return void

SetSideMove() public method

Sets speed the client wishes to move sidewards with, positive to move right, negative to move left.
public SetSideMove ( double speed ) : void
speed double The new speed to request.
return void

SetUpMove() public method

Sets speed the client wishes to move upwards with, negative to move down.
public SetUpMove ( double speed ) : void
speed double The new speed to request.
return void

SetViewAngles() public method

Sets the direction the client wants to move in.
public SetViewAngles ( Angle viewAngle ) : void
viewAngle Angle New view angles.
return void

TickCount() public method

Returns tick count since joining the server. Sometimes returns 0.
public TickCount ( ) : double
return double