26.10.2014, 00:08
use trigonometry
i didnt test the code but somehow atleast should give u an idea
pawn Код:
new Float:Ox,Float:Oy,Float:Oz,//objects coords
Float:Px,Float:Py,Float:Pz,Float:Pangle;
GetPlayerPos(playerid,Px,Py,Pz);
new Float:Hypotenuse=GetPlayerDistanceFromPoint(playerid,Ox,Oy,Oz);
new Float:Adjacent=floatadd(floatabs(Ox),(float(Px)*(-1)));
Pangle=acos(Adjacent/Hypotenuse)*(-1);
SetPlayerFacingAngle(playerid,Pangle);
SetPlayerControllable(playerid,1);