SetVehicleVelocity
Description:
Function SetVehicleVelocity sets the X, Y and Z velocity of a vehicle.
Function SetVehicleVelocity was added in 0.3a and will not work in earlier versions! |
This function has no affect on un-occupied vehicles and does not affect trains. |
Parameters:
(vehicleid, Float:X, Float:Y, Float:Z)
int | vehicleid | The ID of the vehicle to set the velocity of. |
float | X | The velocity in the X direction. |
float | Y | The velocity in the Y direction. |
float | Z | The velocity in the Z direction. |
Return Values:
- 1: The function was executed successfully.
- 0: The function failed to execute. The vehicle does not exist.
Examples:
public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp("/jump", cmdtext)) { if(IsPlayerInAnyVehicle(playerid)) SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 0.2); return 1; } }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- SetPlayerVelocity: Set a player's velocity.
- GetPlayerVelocity: Get a player's velocity.
- GetVehicleVelocity: Get a vehicle's velocity.
- SetVehicleAngularVelocity: Set the angular velocity of a vehicle.