( NEED HELP ) Removing peds from a certain area

Hello !
So, i’m trying to remove the Lost Mc Ped from their HQ in town since on my server it is used for another biker club. I did so by using codewalker … My problem is that each time i run the Ymf to remove them in my server it breaks the animal spawn. No deer or any other animals ( except a few birds ) will spawn anymore.

Can anyone help me out please?

Look with it

This would clear pedestrians as well, possibly AI Vehicles

I tried but it didn’t work :confused:

this is how i wrote it in a client.lua :

ClearAreaOfPeds(976.95, -117.13, 74.26, 30.0, 1)


No you have to create a loop !

while (true) do
ClearAreaOfPeds(3976.95, -117.13, 74.26, 30.0, 1)

Oh ! let me try that :o

Doesn’t work :frowning:

I even tried to just move the spawning scenarios under the map but with no success… that still break the animals spawning :confused:

I’m not sure this is the best/most optimized way to do it but you could use the populationPedCreating event to check if the ped getting created is within 25 units of the certianArea and remove them if they are.

This would be on the client-side:

local areaRadius = 25.0
local certianArea = vector3(976.95, -117.13, 74.26)

AddEventHandler('populationPedCreating', function(x, y, z, model, setters)
    if #(certianArea - vector3(x, y, z)) < areaRadius then