Hi there everyone!
I am trying to implement some code I found for clearing an area but I’m having a problem making it work.
The command needs to be serverside so it can be restricted but I’m just not handling passing the radius variable correctly, I think. The resource starts fine but I get scheduler errors when i try /clearall 20
Client:
RegisterNetEvent('cia:clearAll')
AddEventHandler('cia:clearAll', function(radius)
local radius = radius
local TRadius = radius + 0.0
local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
-- Props
ClearAreaOfObjects(x, y, z, TRadius, 1)
-- NPC Police
ClearAreaOfCops(x, y, z, TRadius, 1)
-- Pedestrians
ClearAreaOfPeds(x, y, z, TRadius, 1)
-- rounds/weaps
ClearAreaOfProjectiles(x, y, z, TRadius, 1)
-- Vehicles
ClearAreaOfVehicles(x, y, z, TRadius, false, false, false, false, false)
end)
Server:
RegisterCommand("clearall", function(source, args, rawCommand)
TriggerClientEvent('cia:clearAll', radius)
end, true)
Can someone tell me what I’m doing wrong?
Thanks for your time!