SetPlayerVelocity

From SA-MP Wiki

Jump to: navigation, search

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.


Parameters:
(playerid, Float:x, Float:y, Float:z)
playeridThe player to apply the speed to.
Float:xHow much speed in the X direction will be applied.
Float:yHow much speed in the Y direction will be applied.
Float:zHow 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.

Personal tools