Howdy,
So I know there is a native call to remove NPCS from an area, but it doesn’t seem to be working, most likely because my implementation is incorrect. Just trying to figure out what I need to do to fix it.
I’ve added in my main.lua for the client side of things
Citizen.CreateThread(function()
while (true) do
ClearAreaOfPeds(470.00, -990.00, 25.00, 10000, 1)
Citizen.Wait(0)
end
end)
Any suggestions / input? I’ve managed to get a functional server, but writing this lul on my part. I should add, that I’m not trying to remove NPC’s from the map, just from a certain location on the map.
6 Likes
Radius is a float so need to end with a .0
4 Likes
Okay so technically you’re saying
ClearAreaOfPeds(470.00, -990.00, 25.00, 10000.0, 1)
??
I’ll give it a shot, thanks!
what about removing npc’s car from a specific location?
1 Like
There is a native for it;
CLEAR_AREA_OF_VEHICLES(0, 0, 0, 10000, false, false, false, false, false);
So you can implement with something like
ClearAreaOfVehicles(-555.65, 285.38, 82.18, 10.0, false, false, false, false, false);
1 Like
Hey guys, anyone can send me a template of this ? Sorry but i’m new to this and can’t workout on a solution :\
Just put this in a client file @afonsoamaral
Citizen.CreateThread(function()
while (true) do
ClearAreaOfPeds(470.00, -990.00, 25.00, 50.0, 1)
Citizen.Wait(0)
end
end)
Obviously replace the coordinates to where you need them and the radius.
ClearAreaOfPeds(x.x, x.x, x.x, x.x, 1)
??
2 Likes
@ItzBlakeBro the thing is that i’m trying to put on a map, so i’d have to create the file from scratch…
@afonsoamaral Sure no problem
So, create a folder like I did called “cleararea”
make a __resource.lua file with
resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"
client_scripts {
"client/main.lua"
}
Then for client/main.lua
Citizen.CreateThread(function()
while (true) do
ClearAreaOfPeds(470.00, -990.00, 25.00, 50.0, 1)
Citizen.Wait(0)
end
end)
2 Likes
is this script only for NPCs or also for Vehicle Spawns?
ItzBlakeBro:
ClearAreaOfVehicles(-555.65, 285.38, 82.18, 10.0, false, false, false, false, false);
So you can use something like
Citizen.CreateThread(function()
while (true) do
ClearAreaOfVehicles(-555.65, 285.38, 82.18, 10.0, false, false, false, false, false);
Citizen.Wait(0)
end
end)
2 Likes
it does not work
Will it be because I have onesync?
Honestly not sure, seems to work fine for me and I’m running a normal 32
@ItzBlakeBro do you by any chance know how to not do it by coords, but by obejct?
For example when placing an object down, the AI gets calm/remopved around that object.
I’m sure it can be done, but I’m not sure exactly how to go about that, that would be a bit more in depth as you’d need a few functions most likely.
Hey man, two questions. First, a radius of 50.0 is that huge or how big would that be?
Second, I see you have client/main.lua would I call it clinet.lua or main.lua?
Thanks in advance.
Trayway
November 23, 2020, 4:52pm
19
Hello bro, do u have an idea how we do to make spawn pnj but only in a certain zone