[INC] USEFUL: Forward velocity... -
No comment.
pawn Код:
stock bool:SetPlayerForwardVelocity(playerid, Float:Velocity, Float:Z)
{
if(!IsPlayerConnected(playerid)) return false;
new Float:Angle;
new Float:SpeedX, Float:SpeedY;
GetPlayerFacingAngle(playerid, Angle);
SpeedX = floatsin(-Angle, degrees);
SpeedY = floatcos(-Angle, degrees);
SetPlayerVelocity(playerid, floatmul(Velocity, SpeedX), floatmul(Velocity, SpeedY), Z);
return true;
}
stock bool:SetVehicleForwardVelocity(vehicleid, Float:Velocity, Float:Z)
{
new Float:Angle;
new Float:SpeedX, Float:SpeedY;
GetVehicleZAngle(vehicleid, Angle);
SpeedX = floatsin(-Angle, degrees);
SpeedY = floatcos(-Angle, degrees);
SetVehicleVelocity(vehicleid, floatmul(Velocity, SpeedX), floatmul(Velocity, SpeedY), Z);
return true;
}
Re: [INC] USEFUL: Forward velocity... -