local ev = require("samp.events")
local active = false
pref = "{ff0000}[{ffffff}CAREJECTOR{ff0000}]{ffffff} "
function main()
if not isSampLoaded() then return end
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand("carejector", function ()
active = not active
if active then sampAddChatMessage(pref.."Выбрасыватель из тачек {00ff00}АКТИВИРОВАН.", -1)
else sampAddChatMessage(pref.."Выбрасыватель из тачек {ff0000}ДЕАКТИВИРОВАН.", -1) end
end)
sampAddChatMessage(pref.."Выбрасыватель из тачек {ffff00}загружен. {ffffff}Автор: stool (bg, tg: @sto_ol)", -1)
lua_thread.create(function ()
while true do
if isCharInAnyCar(PLAYER_PED) and active then
local car = storeCarCharIsInNoSave(PLAYER_PED)
local maxPeds = getMaximumNumberOfPassengers(car)
local _, playerPedID = sampGetPlayerIdByCharHandle(PLAYER_PED)
for i=0, maxPeds do
if not isCarPassengerSeatFree(car, i) then
-- print(os.time(), "DA SUKA RABOTAI!! PASSENGER SEAT :", i)
local ped = getCharInCarPassengerSeat(car, i)
local result, pedID = sampGetPlayerIdByCharHandle(ped)
if result then
if pedID ~= playerPedID then
-- sampAddChatMessage("NAHUI PASSAJIRA: " .. pedID, -1)
sampSendChat(("/eject %s"):format(pedID))
wait(10)
end
end
end
end
end
wait(10)
end
end)
while true do wait(0) end
end
function ev.onServerMessage(color, text)
if active then
if text:find("Не флуди!") then return false end
if text:find("попытался выкинуть из транспорта игрока") then return false end
end
end