Scripting/Squirrel/Functions/Vehicle.AddSpeed

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
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