I try to get rid of peds and vehicles on my server with help of this topic but in c# it does’n work.
My code:
class Environment : BaseScript
{
public Environment()
{
Tick += OnTick;
}
public async Task OnTick()
{
API.SetVehicleDensityMultiplierThisFrame(0.0f);
API.SetPedDensityMultiplierThisFrame(0.0f);
API.SetRandomVehicleDensityMultiplierThisFrame(0.0f);
API.SetParkedVehicleDensityMultiplierThisFrame(0.0f);
API.SetSomeVehicleDensityMultiplierThisFrame(0.0f);
API.SetScenarioPedDensityMultiplierThisFrame(0.0f, 0.0f);
Vector3 pos = LocalPlayer.Character.Position;
API.RemoveVehiclesFromGeneratorsInArea(pos.X - 500.0f, pos.Y - 500.0f, pos.Z - 500.0f, pos.X + 500.0f, pos.Y + 500.0f, pos.Z + 500.0f, 1);
API.SetGarbageTrucks(false);
API.SetRandomBoats(false);
API.SetPlayerWantedLevelNoDrop(LocalPlayer.Handle, 5, true);
await Delay(1000);
}
}
Can anybody help me? Thanks.