SetPlayerVelocity
Description:
Function SetPlayerVelocity set a player's velocity on the X, Y and Z axes.
Function SetPlayerVelocity was added in 0.3a and will not work in earlier versions! |
Parameters:
(playerid, Float:X, Float:Y, Float:Z)
int | playerid | The player to apply the speed to. |
float | X | The velocity (speed) on the X axis. |
float | Y | The velocity (speed) on the Y axis. |
float | Z | The velocity (speed) on the Z axis. |
Return Values:
- 1: The function was executed successfully.
- 0: The function failed to execute. This means the player is not connected.
Examples:
public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp("/jump", cmdtext)) { SetPlayerVelocity(playerid, 0.0, 0.0, 0.2); // Forces the player to jump (Z velocity + 0.2) return 1; } return 0; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetPlayerVelocity: Get a player's velocity.
- SetVehicleVelocity: Set a vehicle's velocity.
- GetVehicleVelocity: Get a vehicle's velocity.