SetMyFacingAngle

From NPC for VCMP 0.4 Servers
Revision as of 14:52, 15 March 2022 by 137.97.101.184 (talk) (Created page with "{{Welcome| desc= Sets the facing angle of an NPC| params=<syntaxhighlight lang="lua">(angle)</syntaxhighlight> <poem>::angle : The new angle (in radians) for the NPC.</poem>|...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Description:
Sets the facing angle of an NPC


Parameters:

(angle)

angle : The new angle (in radians) for the NPC.


Return Values:
This function does not return any specific values.


Example

function OnPlayerText(playerid, message)
{
	if(message=="lookatme")
	{
		local pos=GetPlayerPosition(playerid);local mypos=GetMyPos();
		local angle=atan2(-(pos.x-mypos.x),pos.y-mypos.y)
		SetMyFacingAngle(angle);
	}
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.