SA-MP Forums Archive
SetPlayerFacingAngleToPoint or ToObject - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPlayerFacingAngleToPoint or ToObject (/showthread.php?tid=127404)



SetPlayerFacingAngleToPoint or ToObject - sushihusi - 13.02.2010

Hey All !!
I am doing a sport gamemode and i need something.
I have created an object(a ball). I need to set the player's facing angle to this object, but the object is allways somewhere else and i don't know the correct angle.
Is there an useful function SetPlayerFacingAngleToPoint or SetPlayerFacingAngleToObject or SetPlayerFacingAngleToPlayer?
Can somebody help me?


Re: SetPlayerFacingAngleToPoint or ToObject - sushihusi - 13.02.2010

Now i dont need it because I have found it

Код:
stock GetAngleToXY(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);
}