[Include] [INC] USEFUL: Forward velocity...
#1

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:
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;
}
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!
Reply
#2

Horrible , and never try to log into my account!!!
Offtopic: muhaha good work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)