#Remove NPC from specific part of the map

1 messages · Page 1 of 1 (latest)

high loom
#

Hi! I have a problem in specific parts of the Map. I need to remove the NPC spawn in specific part of the server. It's possible in one part of the qb-core or I need to create a script about them. Thanks ❤️

north yew
#
    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.
silver raptor
#

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

high loom
#

The number 1 is the radius?

spiral atlas