Scripting/Squirrel/Functions/Vehicle.AddSpeed
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
Adds vehicle speed.
Syntax
vehicle.AddSpeed(Vector(x, y, z));
Arguments
- float x - float variable in to which to store the vehicle's X velocity.
- float y - float variable in to which to store the vehicle's Y velocity.
- float z - float variable in to which to store the vehicle's Z velocity.
Example
function onScriptLoad()
{
LMB <- BindKey(true,0x01,0,0);//Button LMB = 0x01
}
function onKeyDown( player, key )
{
if(key == LMB )
{
local vehicle = player.Vehicle;
if (vehicle != null)
{
vehicle.AddSpeed(Vector(vehicle.Speed.x *1.0, vehicle.Speed.y *1.0, vehicle.Speed.z *1.0));
}
}
return 1;
}
Notes
- Callbacks onScriptLoad and onKeyDown were used in this example. More info about them in the corresponding pages.
- Virtual Key Codes — a list of keys and their key codes that can be used for keybinds
Related Functions
- ResetAllVehicleHandling
- IsHandlingRuleSet
- SetHandlingRule
- GetHandlingRule
- ResetHandlingRule
- ResetVehicleHandling
- Vehicle.AddRelTurnSpeed
- Vehicle.AddSpeed
- Vehicle.AddTurnSpeed
- Vehicle.Alarm
- Vehicle.Angle
- Vehicle.Colour1
- Vehicle.Colour2
- Vehicle.Damage
- Vehicle.Delete
- Vehicle.Driver
- Vehicle.EulerAngle
- Vehicle.EulerSpawnAngle
- Vehicle.Fix
- Vehicle.GetHandlingData
- Vehicle.GetOccupant
- Vehicle.GetPart
- Vehicle.GetTyre
- Vehicle.Health
- Vehicle.ID
- Vehicle.Immunity
- Vehicle.IsGhost
- Vehicle.IsHandlingSet
- Vehicle.Kill
- Vehicle.Lights
- Vehicle.Locked
- Vehicle.Model
- Vehicle.Pos
- Vehicle.Radio
- Vehicle.RadioLocked
- Vehicle.RelativeSpeed
- Vehicle.RelativeTurnSpeed
- Vehicle.ResetAllHandling
- Vehicle.ResetHandlingData
- Vehicle.Respawn
- Vehicle.RespawnTimer
- Vehicle.Rotation
- Vehicle.SetFlatTyres
- Vehicle.SetHandlingData
- Vehicle.SetPart
- Vehicle.SetTyre
- Vehicle.Siren
- Vehicle.SpawnAngle
- Vehicle.SpawnPos
- Vehicle.Speed
- Vehicle.StreamedForPlayer
- Vehicle.SyncSource
- Vehicle.SyncType
- Vehicle.TurnSpeed
- Vehicle.TurretRotation
- Vehicle.World
- Vehicle.Wrecked