--  LUA   TaskTurnPedToFaceEntity  0x5AD23D40115353AC  TASK_TURN_PED_TO_FACE_ENTITY
TaskTurnPedToFaceEntity(
	ped --[[ Ped ]], 
	targetEntity --[[ Entity ]], 
	duration --[[ integer ]], 
	p3 --[[ number ]], 
	p4 --[[ number ]], 
	p5 --[[ number ]]
)

duration: the amount of time in milliseconds to do the task. -1 will keep the task going until either another task is applied, or CLEAR_ALL_TASKS() is called with the ped
 

Parameters:

ped:

EntityID — Usually the npc you want to turn.

targetEntity:

EntityID — The npc or player you want the first npc to face.

duration:

duration: the amount of time in milliseconds to do the task.
-1 will keep the task going until either another task is applied, or CLEAR_ALL_TASKS() is called with the ped.

p3:

number. Not used in my example, so it may assume nil or a default value.

p4:

number. Not used in my example, so it may assume nil or a default value.

p5:

number. Not used in my example, so it may assume nil or a default value.

Summary

sentence.

Example

---  
if distance <= 10.0 and distance >= 3.0 then -- check distance  
	Citizen.CreateThread(function()                                 
		SetBlockingOfNonTemporaryEvents(NPCEntityID, false)
		FreezeEntityPosition(NPCEntityID, false)
		TaskTurnPedToFaceEntity(NPCEntityID, player, -1) 
		--print("NPC face players")
	end)  
end 
    


Additional natives used in this example, or natives commonly used with this native.

Common Errors or Problems

Problem: None that I know of at this time, please let us know if you encounter any error or bugs.

Problem: sentence.

Problem: sentence.

Credits and Disclaimers

The base of this data was taken from the redm/cfx fivem/rdr docs, and vespura. We have been saving and making notes for two years now, and are now adding them to our site for everyone to use. We will be modifying the notes as needed, and building tutorials around the data so these pages will change as we work on it. This is a manual process, not an automated one, so updates will occur as we have time, the priority is releasing resources. Thanks for your patience.

Was the documentation useful?

Related Examples and Posts

By MK