16.02.2009, 17:22
Quote:
Originally Posted by Marcel
Straight from pawn-lang.pdf:
Quote:
|
@ [LDT]LuxurY:
The code is ready now
Код:
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); }
Pa = floatadd(Pa, 90.0);
you forgot that
it's because the angles in gta are 90° less (it's 90° rotated)
and why did you do
if (Pa >= 360.0) Pa = 0.0;
?
wtf if the value is higher than 360 it'll become 0°
another thing:
wiki is a little wrong here https://sampwiki.blast.hk/wiki/SetPlayerFacingAngle
it says:
Quote:
north (0) | (270)west- -east (90) (Good way to remember: Never Eat Shredded Wheat) | south (180) |
Quote:
north (0) | (90)west- -east (270) (Good way to remember: Never Eat Shredded Wheat) | south (180) |