Removing NPC's from Specific location

There are some scripts here on the forums that you can use to find coordinates.

You could try something like this

1 Like

You have NPC for Zone?

This may also help if you want to combine both natives:

local clearPedsAndVehicle = {
	{coords = vector3(1398.55, 1147.87, 114.33), radius = 50.0}, -- example location
}

CreateThread(function()
	while true do
		Wait(0)

		for _,v in pairs(clearPedsAndVehicle) do
			ClearAreaOfVehicles(v.coords, v.radius)
			ClearAreaOfPeds(v.coords, v.radius, 1)
		end

	end
end)```

Hey can you tell me how i have to write the script that only vehicles do not spawn? I will have the peds on my Mlo.

Try this inside a .lua in a script with client folder somewhere:

Citizen.CreateThread(function()
    while (true) do
		ClearAreaOfPeds(1996.51, 3062.09, 47.05, 50.0, 1)  --X, Y, Z, Radius (must have .0)
        Citizen.Wait(10000)
    end
end)

For just vehicles you cna also use:

Citizen.CreateThread(function()
    while (true) do
		ClearAreaOfVehicles(1996.51, 3062.09, 47.05, 50.0, 1, 10.0, false, false, false, false, false); --X, Y, Z, Radius (must have .0)
        Citizen.Wait(10000)
    end
end)
1 Like

With this code Citizen.CreateThread(function()
while (true) do
ClearAreaOfVehicles(1996.51, 3062.09, 47.05, 50.0, 1, 10.0, false, false, false, false, false); --X, Y, Z, Radius (must have .0)
Citizen.Wait(10000)
end
end)

the npc will not be there! We using QB-Core

where would i find this in my files ?

which coords are which tho

Thanx for the info, i got it working. :smiley:

Thank you so much, you help me to clear area on this ymap picture](https://cdn.discordapp.com/attachments/1186290611993722890/1201683456019669013/screenshot.jpg?ex=65cab5ee&is=65b840ee&hm=7ec76c4fdaf910a7e77dab49acb4fabe9e9dee3cfd57993adec081f21b6ccf98&)

I’m using qb-core.

Use PoliZone to improve performance

1 Like

How would make it remove all npc spawn in a polyzone?