SetVehicleVelocity

From SA-MP Wiki

Jump to: navigation, search

SetVehicleVelocity


Warning: This function was added in SA-MP version 0.3. It is not available in previous versions.


Sets the X, Y and Z velocity of a vehicle


Important Note: This function has no effect on un-occupied vehicles!


Parameters:
(vehicleid, Float:x, Float:y, Float:z)
vehicleidThe ID of the vehicle to set the velocity of.
Float:xThe amount of velocity in the X direction.
Float:yThe amount of velocity in the Y direction .
Float:zThe amount of velocity in the Z direction.


This function does not return a specific value.


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