local q = require 'lib.samp.events'
local bit = require 'lib.samp.events.bitstream_io'
del = false
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(2000) end
sampRegisterChatCommand('deletecars', delete)
sampRegisterChatCommand('deletecar', deletecar)
wait(-1)
end
function deletecar(id)
idik = tonumber(id)
if idik == "" then
print("no param")
else
hideCar(idik)
end
end
function q.onVehicleStreamIn()
if del then
return false
end
end
function delete()
del = not del
if del then
print("true")
local cars = getAllVehicles()
for i = 1, #cars do
local res, id = sampGetVehicleIdByCarHandle(cars[i])
if res and cars[i] ~= 1 then
hideCar(id)
end
end
else
print("false")
end
end
function hideCar(id)
local w = bit.bs_write
local bs = raknetNewBitStream()
w.int16(bs, id)
raknetEmulRpcReceiveBitStream(165, bs)
end