Scripting/Squirrel/Functions/Vehicle.AddSpeed: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "Adds vehicle speed. == Syntax == <pre>vehicle.AddSpeed(Vector(x, y, z));</pre> == Arguments == *''float'' '''x''' - float variable in to which to store the vehicle's X vel...") |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 10: | Line 10: | ||
*''float'' '''y''' - float variable in to which to store the vehicle's Y 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 | *''float'' '''z''' - float variable in to which to store the vehicle's Z velocity. | ||
== Example == | == Example == | ||
Line 37: | Line 37: | ||
* Callbacks [[onScriptLoad]] and [[onKeyDown]] were used in this example. More info about them in the corresponding pages. | * Callbacks [[onScriptLoad]] and [[onKeyDown]] were used in this example. More info about them in the corresponding pages. | ||
* [https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx Virtual Key Codes] — a list of keys and their key codes that can be used for keybinds | * [https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx Virtual Key Codes] — a list of keys and their key codes that can be used for keybinds | ||
== Related Functions == | |||
{{Scripting/Squirrel/Functions/Vehicle_Functions}} | |||
[[Category:Scripting/Squirrel/Functions/Vehicle_Functions]] |
Latest revision as of 22:01, 30 January 2017
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