21.01.2010, 18:56
Hi. I made these two functions, because I was bored...
SetPlayerForwardVelocity(playerid, Float:Velocity, Float:Z);
Set some forward velocity to player.
SetVehicleForwardVelocity(vehicleid, Float:Velocity, Float:Z);
No comment.
Here they are:
CREDITS: Someone who have made GetXYInFrontOfPlayer... It helped me a lot. And Kurence for an idea...
I hope you like them... Have a lot of fun!
SetPlayerForwardVelocity(playerid, Float:Velocity, Float:Z);
Set some forward velocity to player.
SetVehicleForwardVelocity(vehicleid, Float:Velocity, Float:Z);
No comment.
Here they are:
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;
}
I hope you like them... Have a lot of fun!