sampRegisterChatCommand('timer', function(sec)
timer = not timer
if timer and tonumber(sec) then
local sec = tonumber(sec)
if sec > 0 then
timer_thread = lua_thread.create(function()
sampAddChatMessage('Таймер на '..sec..' секунд запущен!', -1)
local start = os.time()
while os.time() - start < sec do
wait(1000)
sampAddChatMessage(sec - (os.time() - start), -1)
end
sampAddChatMessage('Время вышло!', -1)
end)
end
return
end
timer_thread:terminate()
sampAddChatMessage('Таймер остановлен!', -1)
end)