SetVehicleVelocity

From SA-MP Wiki

Jump to: navigation, search


SetVehicleVelocity was added in SA-MP 0.3a This function was added in SA-MP 0.3a and will not work in earlier versions!


Description:

Sets the X, Y and Z velocity of a vehicle.


Image:32px-Circle-style-warning.png

Important
Note

This function has no affect on un-occupied vehicles and does not affect trains.


Parameters:
(vehicleid, Float:X, Float:Y, Float:Z)
vehicleidThe ID of the vehicle to set the velocity of.
Float:XThe velocity in the X direction.
Float:YThe velocity in the Y direction .
Float:ZThe velocity in the Z direction.


Return Values:

  • 1: The function executed successfully.
  • 0: The function failed to execute. The vehicle does not exist.


Example Usage:

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/jump", cmdtext))
    {
	if(IsPlayerInAnyVehicle(playerid))
        SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.2);
	return 1;
    }
}
Personal tools
In other languages