SetPlayerVelocity
From SA-MP Wiki
SetPlayerVelocity
Warning: This function was added in SA-MP version 0.3. It is not available in previous versions.
Makes the player move in that direction at the given speed.
(playerid, Float:x, Float:y, Float:z)
| playerid | The player to apply the speed to. |
| Float:x | How much speed in the X direction will be applied. |
| Float:y | How much speed in the Y direction will be applied. |
| Float:z | How much speed in the Z direction will be applied. |
This function does not return a specific value.
public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp("/jump", cmdtext)) { SetPlayerVelocity(playerid,0.0,0.0,0.2); //Forces the player to jump return 1; } if (!strcmp("/sink", cmdtext)) { SetPlayerVelocity(playerid,0.0,0.0,-0.5); //Forces the player to sink return 1; } return 0; }
Related Functions
The following functions might be useful as well, as they're 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.
