25.11.2014, 01:17
I don't know how the fuck to do this.
I need a function that will set a player's facing angle to look at an X/Y position coords.
This isn't working:
I need a function that will set a player's facing angle to look at an X/Y position coords.
This isn't working:
pawn Код:
//Credits to Zeex
stock SetPlayerLookAt(playerid, Float:X, Float:Y)
{
new
Float:pX,
Float:pY,
Float:pZ;
GetPlayerPos(playerid, pX, pY, pZ);
return SetPlayerFacingAngle(playerid, -acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);
}