How? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How? (
/showthread.php?tid=256863)
How? -
[KO]KillerThriller - 22.05.2011
How can i make like, it set's an object facing angle to my facing angle?
Like if Im facing north and the object is facing south, and i press KEY_FIRE it set's the object facing angle to north?
I know it's with SetObjectRot but im not sure how to make it.
Respuesta: How? -
admantis - 22.05.2011
pawn Код:
stock SetObjectRotToPlayerAngle(i_Obj, i_Player) // admantis
{
new
Float:f_Angle
,Float:f_rX
,Float:f_rY
,Float:f_rZ
;
if (i_Player == 0xFFFF || !IsValidObject(i_Obj))
return false;
GetPlayerFacingAngle(i_Player, f_Angle);
GetObjectRot(i_Obj, f_rX, f_rY, f_rZ);
SetObjectRot(i_Obj, f_rX, f_rY, f_Angle);
return i_Obj;
}