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
Afficher le fichier Open project: OmegaExtern/gmod-csharp-binary-module

Méthodes publiques

Méthode 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 méthode

public CUserCmd ( int index ) : GarrysModLuaShared.Enums
index int
Résultat GarrysModLuaShared.Enums

ClearButtons() public méthode

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

ClearMovement() public méthode

Clears the movement from the command.
public ClearMovement ( ) : void
Résultat void

CommandNumber() public méthode

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
Résultat double

GetButtons() public méthode

Returns a bitflag indicating which buttons are pressed.
public GetButtons ( ) : IN
Résultat IN

GetForwardMove() public méthode

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

GetImpulse() public méthode

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

GetMouseWheel() public méthode

Returns the scroll delta as whole number.
public GetMouseWheel ( ) : double
Résultat double

GetMouseX() public méthode

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

GetMouseY() public méthode

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

GetSideMove() public méthode

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
Résultat double

GetUpMove() public méthode

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

GetViewAngles() public méthode

Gets the direction the client wants to move in.
public GetViewAngles ( ) : Angle
Résultat Angle

KeyDown() public méthode

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

RemoveKey() public méthode

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

SelectWeapon() public méthode

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.
Résultat void

SetButtons() public méthode

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

SetForwardMove() public méthode

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.
Résultat void

SetImpulse() public méthode

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

SetMouseWheel() public méthode

Sets the scroll delta.
public SetMouseWheel ( double delta ) : void
delta double The scroll delta.
Résultat void

SetMouseX() public méthode

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

SetMouseY() public méthode

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

SetSideMove() public méthode

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.
Résultat void

SetUpMove() public méthode

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.
Résultat void

SetViewAngles() public méthode

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

TickCount() public méthode

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