22.09.2010, 15:06
Hello guys.
I'm making a simple flying script, but it keeps making me face 0.0.
Can you guys see what's wrong?
I'm making a simple flying script, but it keeps making me face 0.0.
Код:
public OnPlayerUpdate(playerid)
{
if(GetPVarInt(playerid, "Superman") == 1)
{
GetPlayerKeys(playerid,Keys,ud,lr);
if(Keys & KEY_SPRINT)
{
GetPlayerPos(playerid, x2, y2, z2);
GetPlayerCameraFrontVector(playerid, x, y, z);
GetAngle(x, y, x2, y2, Anglez);
SetPlayerFacingAngle(playerid, Anglez);
SetPlayerVelocity(playerid, x*1.07, y*1.07, z*1.07);
ApplyAnimation(playerid,"PARACHUTE","FALL_SkyDive_Accel",4.1,1,1,1,1,0);
}
else
{
SetPlayerVelocity(playerid, 0, 0, 0);
ApplyAnimation(playerid,"FAT","FatIdle",4.1,0,1,1,1,0);
}
}
return 1;
}
//-------------------------------------------------------
stock GetAngle(Float:X, Float:Y, Float:CurrentX, Float:CurrentY, &Float:Angle)
{
Angle = atan2(Y-CurrentY, X-CurrentX);
Angle = floatsub(Angle, 90.0);
if(Angle < 0.0){
Angle = floatadd(Angle, 360.0);
}
}


