[Help] Prevent NPCs from fleeing when guns aimed


#1

I have the below piece of code running but for some reason it doesn’t seem to work. If I am my gun at a car the NPC in the vehicle takes off.


Citizen.CreateThread(function()
  while true do
    Wait(0)
    SetEveryoneIgnorePlayer(PlayerId(), true)
    Citizen.Trace("Everyone ignores you.\n")
  end
end)

Seems that constantly running SuppressShockingEventsNextFrame() accomplishes this task, not sure if its the best method.