VERGELua API

UserCmd

The command sent each tick — buttons, angles, movement.

cmd:GetTickCount():number

Server tick the command is for.

cmd:GetCommandNumber():number

Sequential command number.

cmd:GetButtons():number

Button flags held in this command.

cmd:SetButtons(buttons:number)

Replace the button flags.

cmd:HasButtons(buttons:number):boolean

Whether the command holds the given button flags.

cmd:GetViewAngles():number, number, number

View angles as pitch, yaw and roll.

cmd:SetViewAngles(pitch:number, yaw:number, roll:number)

Set view angles; also accepts a single Vector3.

cmd:GetForwardMove():number

Forward movement amount.

cmd:SetForwardMove(v:number)

Set forward movement amount.

cmd:GetSideMove():number

Sideways movement amount.

cmd:SetSideMove(v:number)

Set sideways movement amount.

cmd:GetUpMove():number

Vertical movement amount.

cmd:SetUpMove(v:number)

Set vertical movement amount.

cmd:GetSendPacket():boolean

Whether this command is sent to the server.

cmd:SetSendPacket(send:boolean)

Choke or send this command.

cmd:GetImpulse():number

Impulse value of the command.

cmd:SetImpulse(impulse:number)

Set the impulse value.

cmd:GetWeaponSelect():number

Weapon entity handle to select.

cmd:SetWeaponSelect(handle:number)

Set the weapon to select.

cmd:GetWeaponSubtype():number

Weapon subtype of the command.

cmd:SetWeaponSubtype(subtype:number)

Set the weapon subtype.

cmd:GetRandomSeed():number

Random seed of the command.

cmd:SetRandomSeed(seed:number)

Set the random seed.

cmd:GetMouseDX():number

Mouse delta X of the command.

cmd:GetMouseDY():number

Mouse delta Y of the command.

cmd:GetHasBeenPredicted():boolean

Whether the command has been predicted.

buttons:numberprop

Button flags as a field.

viewangles:Vector3

View angles as a Vector3 field; assigning calls SetViewAngles.

Examples

Auto bunnyhop

Holding space jumps the instant you touch the ground.

callbacks.Register("CreateMove", function(cmd)
    local me = client.GetLocalPlayer()
    if not me:IsValid() or not me:IsAlive() then return end
    if not client.IsKeyDown(KEY_SPACE) then return end

    local vel = me:GetVelocity()
    if math.abs(vel.z) < 0.5 then
        cmd.buttons = cmd.buttons | IN_JUMP
    end
end)