22.10.2012, 21:36
You should / could knew who gets the extra 180° if you wrote the calculation...
Full and working function
Also using arrays is slower than normal variables, just use them if you need them
Full and working function
pawn Код:
stock SetPlayerFacePlayer(playerid, giveplayerid) {
new
Float: pX,
Float: pY,
Float: pZ,
Float: gX,
Float: gY,
Float: gZ
;
if(GetPlayerPos(playerid, pX, pY, pZ) && GetPlayerPos(giveplayerid, gX, gY, gZ)) {
SetPlayerFacingAngle(playerid, (pX = -atan2((gX - pX), (gY - pY))));
return SetPlayerFacingAngle(giveplayerid, (pX + 180.0));
}
return false;
}