C# Класс 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.
Наследование: LuaObject
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Описание методов

CUserCmd() публичный Метод

public CUserCmd ( int index ) : GarrysModLuaShared.Enums
index int
Результат GarrysModLuaShared.Enums

ClearButtons() публичный Метод

Removes all keys from the command. Doesn't prevent movement, see ClearMovement for this.
public ClearButtons ( ) : void
Результат void

ClearMovement() публичный Метод

Clears the movement from the command.
public ClearMovement ( ) : void
Результат void

CommandNumber() публичный Метод

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
Результат double

GetButtons() публичный Метод

Returns a bitflag indicating which buttons are pressed.
public GetButtons ( ) : IN
Результат IN

GetForwardMove() публичный Метод

The speed the client wishes to move forward with, negative if the clients wants to move backwards.
public GetForwardMove ( ) : double
Результат double

GetImpulse() публичный Метод

Gets the current impulse from the client, usually 0.
public GetImpulse ( ) : double
Результат double

GetMouseWheel() публичный Метод

Returns the scroll delta as whole number.
public GetMouseWheel ( ) : double
Результат double

GetMouseX() публичный Метод

Returns the delta of the angular horizontal mouse movement of the player.
public GetMouseX ( ) : int
Результат int

GetMouseY() публичный Метод

Returns the delta of the angular vertical mouse movement of the player.
public GetMouseY ( ) : int
Результат int

GetSideMove() публичный Метод

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
Результат double

GetUpMove() публичный Метод

The speed the client wishes to move up with, negative if the clients wants to move down.
public GetUpMove ( ) : double
Результат double

GetViewAngles() публичный Метод

Gets the direction the client wants to move in.
public GetViewAngles ( ) : Angle
Результат Angle

KeyDown() публичный Метод

Returns true if the specified button(s) is pressed.
public KeyDown ( IN key ) : bool
key IN Bitflag representing which button to check.
Результат bool

RemoveKey() публичный Метод

Removed a key bit from the current key bitflag.
public RemoveKey ( IN button ) : void
button IN Bitflag to be removed from the key bitflag.
Результат void

SelectWeapon() публичный Метод

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.
Результат void

SetButtons() публичный Метод

Sets the buttons bitflag.
public SetButtons ( IN buttons ) : void
buttons IN Bitflag representing which buttons are "down".
Результат void

SetForwardMove() публичный Метод

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.
Результат void

SetImpulse() публичный Метод

Sets the impulse to be send together with the command.
public SetImpulse ( double impulse ) : void
impulse double The impulse to send.
Результат void

SetMouseWheel() публичный Метод

Sets the scroll delta.
public SetMouseWheel ( double delta ) : void
delta double The scroll delta.
Результат void

SetMouseX() публичный Метод

Sets the delta of the angular horizontal mouse movement of the player.
public SetMouseX ( int x ) : void
x int Angular horizontal move delta.
Результат void

SetMouseY() публичный Метод

Sets the delta of the angular vertical mouse movement of the player.
public SetMouseY ( int y ) : void
y int Angular vertical move delta.
Результат void

SetSideMove() публичный Метод

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.
Результат void

SetUpMove() публичный Метод

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.
Результат void

SetViewAngles() публичный Метод

Sets the direction the client wants to move in.
public SetViewAngles ( Angle viewAngle ) : void
viewAngle Angle New view angles.
Результат void

TickCount() публичный Метод

Returns tick count since joining the server. Sometimes returns 0.
public TickCount ( ) : double
Результат double