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 |
||
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 == |
Revision as of 20:33, 22 April 2016
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