I am creating a ped, I wish he shoots, but in this role he does not react after the player shooting
I'm new, I registered in search of a solution for this, I thank you
local function setPedAttackPlayer(thePed)
if(attacking[thePed] == true) then return end
attacking[thePed] = true
attackTimer[thePed] = setTimer(function()
if(getElementHealth(thePed) < 1) then
killTimer(attackTimer[thePed])
else
local x1, y1, z1 = getElementPosition(thePed)
local x2, y2, z2 = getElementPosition(localPlayer)
local rot = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
rot = rot-90
end
end, 500, -1)
end