#Remove NPC from specific part of the map
1 messages · Page 1 of 1 (latest)
local handle, ped = FindFirstPed()
local success
repeat
if DoesEntityExist(ped) then
local pedCoords = GetEntityCoords(ped)
local dist = #(pedCoords - center)
if dist < radius and not IsPedAPlayer(ped) then
DeleteEntity(ped)
end
end
success, ped = FindNextPed(handle)
until not success
EndFindPed(handle)
end
CreateThread(function()
local areaCenter = vector3(200.0, -900.0, 30.0)
local radius = 100.0
while true do
Wait(5000)
DeleteNPCsInArea(areaCenter, radius)
end
end)```
# I have not tested this, This was laying around, If it doesn't work. Let me know.
mine works
Citizen.CreateThread(function()
while (true) do
ClearAreaOfPeds(53.26, -1583.97, 29.5, 321.06, 1)
Citizen.Wait(0)
end
end)
do a vector4 next to ClearAreaOfPeds and remove vector4 part thats all
The number 1 is the radius?
and if i want to add more locations?