16.02.2009, 17:43
Code:
stock SetPlayerLookAt(playerid, Float:x, Float:y) { new Float:Px, Float:Py, Float: Pa; GetPlayerPos(playerid, Px, Py, Pa); Pa = floatabs(atan((y-Py)/(x-Px))); if (x <= Px && y >= Py) Pa = floatsub(180, Pa); else if (x < Px && y < Py) Pa = floatadd(Pa, 180); else if (x >= Px && y <= Py) Pa = floatsub(360.0, Pa); Pa = floatsub(Pa, 90.0); if (Pa >= 360.0) Pa = floatsub(Pa, 360.0); SetPlayerFacingAngle(playerid, Pa); }
http://forum.sa-mp.com/index.php?topic=8...#msg579674