random в lua

izicapt

Известный
Автор темы
360
113
Версия MoonLoader
.027.0-preview
Подсказали мне хорошую идею добавить random в задержку, правда я опять всё сделал за 3 минуты и получил " Парашу "
Чёт не понимаю как правильно добавить рандом
Ошибки как я понимаю в местах на картинке
1679327608098.png

lua:
script_name("AutoPiar")
script_author("ARMOR,Sanchez")
script_version("1.2")

require("lib.moonloader")
local ev = require('lib.samp.events')
local inicfg = require("inicfg")
local imgui = require("imgui")

local encoding = require('encoding')
encoding.default = 'CP1251'
u8 = encoding.UTF8

local font = renderCreateFont("Arial", 10, 9)
local cfg = inicfg.load({
    config = {
        vr = "",
        fam = "",
        j = "",
        s = "",
        ad = "",
    },
    interface = {
        vr_checkbox = false,
        fam_checkbox = false,
        j_checkbox = false,
        s_checkbox = false,
        ad_checkbox = false,
        vr_slider = 1,
        fam_slider = 1,
        j_slider = 1,
        s_slider = 1,
        ad_slider = 1,
        ad_radiobutton = 1,
        theme_id = 0,
    }
}, "AutoPiar.ini")

local enable = false

-- imgui window
local main_window_state = imgui.ImBool(false)

-- imgui checkbox
local vr_check = imgui.ImBool(cfg.interface.vr_checkbox)
local fam_check = imgui.ImBool(cfg.interface.fam_checkbox)
local j_check = imgui.ImBool(cfg.interface.j_checkbox)
local s_check = imgui.ImBool(cfg.interface.s_checkbox)
local ad_check = imgui.ImBool(cfg.interface.ad_checkbox)

-- imgui buffer
local vr = imgui.ImBuffer(''..cfg.config.vr,256)
local fam = imgui.ImBuffer(''..cfg.config.fam,256)
local j = imgui.ImBuffer(''..cfg.config.j,256)
local s = imgui.ImBuffer(''..cfg.config.s,256)
local ad = imgui.ImBuffer(''..cfg.config.ad,256)

-- imgui slider
local vr_slider = imgui.ImInt(cfg.interface.vr_slider)
local fam_slider = imgui.ImInt(cfg.interface.fam_slider)
local j_slider = imgui.ImInt(cfg.interface.j_slider)
local s_slider = imgui.ImInt(cfg.interface.s_slider)
local ad_slider = imgui.ImInt(cfg.interface.ad_slider)

-- imgui radiobutton
local ad_radiobutton = imgui.ImInt(cfg.interface.ad_radiobutton)

-- imgui combo
local themes_combo = imgui.ImInt(cfg.interface.theme_id)

-- other
local delay = 0.5

function main()
    while not isSampAvailable() do wait(100) end

    if not doesFileExist(getWorkingDirectory()..'\\config\\AutoPiar.ini') then inicfg.save(cfg, 'AutoPiar.ini') end

    sampAddChatMessage("[AutoPiar]: {FFFFFF}Скрипт загружен, для настройки введите /ap", 0x5CBCFF)
    sampAddChatMessage("[AutoPiar]: {FFFFFF}Отдельное спасибо: Sanchez", 0x5CBCFF)

    sampRegisterChatCommand("ap", function()
        main_window_state.v = not main_window_state.v
    end)

    while true do wait(0)
        imgui.Process = main_window_state.v

        lockPlayerControl(main_window_state.v or false)
        if enable and not vr_check.v and not fam_check.v and not j_check.v and not ad_check.v and not s_check.v then
            sampAddChatMessage("[AutoPiar]: {FFFFFF}Произошла ошибка, были сняты все CheckBox'ы ", triangle)
            enable = false
        end
    end
end

function piar()
    lua_thread.create(function()
        while enable do wait(0)
            if fam_check.v then
                sampSendChat("/fam " .. u8:decode(cfg.config.fam))
                wait(random(0,30)fam_slider.v*1000)
            end
            if j_check.v then
                sampSendChat("/j " .. u8:decode(cfg.config.j))
                wait(random(0,30)j_slider.v*1000)
            end
            if s_check.v then
                sampSendChat("/s " .. u8:decode(cfg.config.s))
                wait(random(0,10)s_slider.v*1000)
            end
            if vr_check.v then
                sampSendChat("/vr " .. u8:decode(cfg.config.vr))
                                wait(random(0, 60)vr_slider.v*1000)
            end
            if ad_check.v and cfg.interface.ad_radiobutton ~= 0 then -- Может и фиксану когда нибудь
                sampSendChat("/ad " .. u8:decode(cfg.config.ad))
                wait(300)
                sampSendDialogResponse(15346, 1, cfg.interface.ad_radiobutton, nil)
                wait(1000)
                sampCloseCurrentDialogWithButton(1)
                wait(1000)
                sampCloseCurrentDialogWithButton(1)
                wait(ad_slider.v*1000)
            end
        end
    end)
end

function ev.onShowDialog(id, style, title, b1, b2, text)
    if id == 25626 and vr_check.v and enable then --25626
        lua_thread.create(function()
            wait(50)
            sampSendDialogResponse(25627, 1, 1, -1)
            sampCloseCurrentDialogWithButton(1)
        end)
    end
end


local styles = {u8"Синий стиль", u8"Зеленый стиль", u8"Розовый стиль", u8"Оранжевый стиль"}
function imgui.OnDrawFrame()
    team()
    if main_window_state.v then
        local sw, sh = getScreenResolution()

        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(600, 475), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Авто Пиар", main_window_state, imgui.WindowFlags.NoResize)
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /vr")).x)/2)
        imgui.Text(u8"Пиар в /vr")
        if imgui.Checkbox("##1", vr_check) then
            cfg.interface.vr_checkbox = vr_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##2", vr) then
            cfg.config.vr = vr.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##3", vr_slider, 1, 600, u8' %.0f с') then
            cfg.interface.vr_slider = vr_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /fam")).x)/2)
        imgui.Text(u8"Пиар в /fam")
        if imgui.Checkbox("##4", fam_check) then
            cfg.interface.fam_checkbox = fam_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##5", fam) then
            cfg.config.fam = fam.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##6", fam_slider, 1, 600, u8'%.0f с') then
            cfg.interface.fam_slider = fam_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /j")).x)/2)
        imgui.Text(u8"Пиар в /j")
        if imgui.Checkbox("##7", j_check) then
            cfg.interface.j_checkbox = j_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##8", j) then
            cfg.config.j = j.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##9", j_slider, 1, 600, u8'%.0f с') then
            cfg.interface.j_slider = j_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /s")).x)/2)
        imgui.Text(u8"Пиар в /s")
        if imgui.Checkbox("##10", s_check) then
            cfg.interface.s_checkbox = s_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##11", s) then
            cfg.config.s = s.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##12", s_slider, 1, 600, u8'%.0f с') then
            cfg.interface.s_slider = s_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /ad")).x)/2)
        imgui.Text(u8"Пиар в /ad")
        if imgui.Checkbox("##13", ad_check) then
            cfg.interface.ad_checkbox = ad_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##14", ad) then
            cfg.config.ad = ad.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##15", ad_slider, 1, 600, u8'%.0f с') then
            cfg.interface.ad_slider = ad_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        if imgui.RadioButton(u8"Обычное объявление", ad_radiobutton, 1) then
            cfg.interface.ad_radiobutton = ad_radiobutton.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(470)
        if imgui.RadioButton(u8"VIP объявление", ad_radiobutton, 2) then
            cfg.interface.ad_radiobutton = ad_radiobutton.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Цветовая тема окна")).x)/2)
        imgui.Text(u8"Цветовая тема окна")
        if imgui.Combo("##16", themes_combo, styles) then
            cfg.interface.theme_id = themes_combo.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        if imgui.Button(u8((enable  and 'Остановить' or 'Запустить')..' авто-пиар'), imgui.ImVec2(582, 20)) then
            enable = not enable
            if enable then
                piar()
            end
            if not(vr_check.v or fam_check.v or j_check.v or ad_check.v or s_check.v) then
                sampAddChatMessage("[AutoPiar]: {FFFFFF}Небыло выбрано ниодного варианта пиара!", triangle)
                enable = false
            else
                sampAddChatMessage('[AutoPiar]: {FFFFFF}Пиар '..(enable and "активирован!" or "деактивирован!"), triangle)
            end
        end
        imgui.End()
    end
end

function ev.onSendCommand(cmd)
    local result = cmd:match("^/vr (.+)")
    if result ~= nil then
        if process ~= nil and result ~= message then
            process:terminate()
            process = nil
        end
        if process == nil then
            finished, try = false, 1
            message = tostring(result)
            process = lua_thread.create(function()
                while not finished do
                    if sampGetGamestate() ~= 3 then
                        finished = true; break
                    end
                    if not sampIsChatInputActive() then
                        local rotate = math.sin(os.clock() * 3) * 90 + 90
                        local el = getStructElement(sampGetInputInfoPtr(), 0x8, 4)
                        local X, Y = getStructElement(el, 0x8, 4), getStructElement(el, 0xC, 4)
                        renderDrawPolygon(X + 10, Y + (renderGetFontDrawHeight(font) / 2), 20, 20, 3, rotate, 0xFFFFFFFF)
                        renderDrawPolygon(X + 10, Y + (renderGetFontDrawHeight(font) / 2), 20, 20, 3, -1 * rotate, triangle)
                        renderFontDrawText(font, message, X + 25, Y, -1)
                        renderFontDrawText(font, string.format(" [x%s]", try), X + 25 + renderGetFontDrawTextLength(font, message), Y, 0x40FFFFFF)
                    end
                    wait(0)
                end
                process = nil
            end)
        end
    end
end

function ev.onServerMessage(color, text)
    if text:find("%[%u+%] {%x+}[A-z0-9_]+%[" .. select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) .. "%]:.+") then
        finished = true
    end
    if text:find("^%[Ошибка%].*После последнего сообщения в этом чате нужно подождать") then
        lua_thread.create(function()
            wait(delay * 1000);
            sampSendChat("/vr " .. message)
            try = try + 1
        end)
        return false
    end
    if text:find("^Вы заглушены") or text:find("Для возможности повторной отправки сообщения в этот чат") then
        finished = true
    end
end
function team()
    local style = imgui.GetStyle()
    local clrs = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4
    style.Alpha = 1
    style.ChildWindowRounding = 0
    style.WindowRounding = 0
    style.GrabRounding = 0
    style.GrabMinSize = 12
    style.FrameRounding = 5
    if themes_combo.v == 0 then
        triangle = 0xFF002779
        clrs[clr.Text] = ImVec4(1, 1, 1, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(9.9998999303352e-07, 9.9999613212276e-07, 9.9999999747524e-07, 0)
        clrs[clr.PopupBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.Border] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.BorderShadow] = ImVec4(9.9999999747524e-07, 9.9998999303352e-07, 9.9998999303352e-07, 0)
        clrs[clr.FrameBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.FrameBgHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.FrameBgActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.TitleBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.TitleBgActive] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.MenuBarBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0.14883691072464, 0.14883720874786, 0.14883571863174, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.ComboBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.ButtonActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.Header] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.HeaderActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.Separator] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.ResizeGripActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.CloseButton] = ImVec4(0.19607843458652, 0.19607843458652, 0.19607843458652, 0.88235294818878)
        clrs[clr.CloseButtonHovered] = ImVec4(0.19607843458652, 0.19607843458652, 0.19607843458652, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.19607843458652, 0.19607843458652, 0.19607843458652, 0.60784316062927)
        clrs[clr.PlotLines] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(1, 0.99999779462814, 0.99998998641968, 1)
        clrs[clr.PlotHistogram] = ImVec4(1, 0.99999779462814, 0.99998998641968, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(1, 0.9999960064888, 0.99998998641968, 1)
        clrs[clr.TextSelectedBg] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    elseif themes_combo.v == 1 then
        triangle = 0xFF007723
        clrs[clr.Text] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(0, 0, 0, 0)
        clrs[clr.PopupBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.Border] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.BorderShadow] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.FrameBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.FrameBgHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.58823531866074)
        clrs[clr.FrameBgActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.39215686917305)
        clrs[clr.TitleBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.82352942228317)
        clrs[clr.TitleBgActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.66666668653488)
        clrs[clr.MenuBarBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.58823531866074)
        clrs[clr.ComboBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.ButtonActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.Header] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.HeaderActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.Separator] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.ResizeGripActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.CloseButton] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 1)
        clrs[clr.CloseButtonHovered] = ImVec4(0.29019609093666, 0.29019609093666, 0.29019609093666, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.77209305763245, 0.77208530902863, 0.77208530902863, 0.7843137383461)
        clrs[clr.PlotLines] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.PlotHistogram] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.TextSelectedBg] = ImVec4(0.25581139326096, 0.25581139326096, 0.25581395626068, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    elseif themes_combo.v == 2 then
        triangle = 0xFFD6388B
        clrs[clr.Text] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(0, 0, 0, 0)
        clrs[clr.PopupBg] = ImVec4(0.70588237047195, 0.011764694936574, 0.37980872392654, 1)
        clrs[clr.Border] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.BorderShadow] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.FrameBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.FrameBgHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.58823531866074)
        clrs[clr.FrameBgActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.39215686917305)
        clrs[clr.TitleBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.82352942228317)
        clrs[clr.TitleBgActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.66666668653488)
        clrs[clr.MenuBarBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.58823531866074)
        clrs[clr.ComboBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.ButtonActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.Header] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.HeaderActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.Separator] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.ResizeGripActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.CloseButton] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 1)
        clrs[clr.CloseButtonHovered] = ImVec4(0.29019609093666, 0.29019609093666, 0.29019609093666, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.77209305763245, 0.77208530902863, 0.77208530902863, 0.7843137383461)
        clrs[clr.PlotLines] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.PlotHistogram] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.TextSelectedBg] = ImVec4(0.25581139326096, 0.25581139326096, 0.25581395626068, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    elseif themes_combo.v == 3 then
        triangle = 0xFFD67200
        clrs[clr.Text] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(0, 0, 0, 0)
        clrs[clr.PopupBg] = ImVec4(0.85116279125214, 0.59383445978165, 0, 1)
        clrs[clr.Border] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.BorderShadow] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.FrameBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.FrameBgHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.58823531866074)
        clrs[clr.FrameBgActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.39215686917305)
        clrs[clr.TitleBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.82352942228317)
        clrs[clr.TitleBgActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.66666668653488)
        clrs[clr.MenuBarBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.58823531866074)
        clrs[clr.ComboBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.ButtonActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.Header] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.HeaderActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.Separator] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.ResizeGripActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.CloseButton] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 1)
        clrs[clr.CloseButtonHovered] = ImVec4(0.29019609093666, 0.29019609093666, 0.29019609093666, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.77209305763245, 0.77208530902863, 0.77208530902863, 0.7843137383461)
        clrs[clr.PlotLines] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.PlotHistogram] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.TextSelectedBg] = ImVec4(0.25581139326096, 0.25581139326096, 0.25581395626068, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    end
end
function random(min, max) -- для рандома
    local kf = math.random(min, max)
    math.randomseed(os.time() * kf)
    local rand = math.random(min, max)
    return tonumber(rand)
end
 
Решение
Пользователь выставил задержку и к этой задержке прибавляется N-ое (рандомное) количество секунд в деапозонах 0-60 например
Я вот чёт тоже не знаю как сделать такую штуку (именно как сложить)
wait(random(0, 60) + (peremennaya.v*1000))

whyega52

Гений, миллионер, плейбой, долбаеб
Модератор
2,762
2,585
Подсказали мне хорошую идею добавить random в задержку, правда я опять всё сделал за 3 минуты и получил " Парашу "
Чёт не понимаю как правильно добавить рандом
Ошибки как я понимаю в местах на картинке
Посмотреть вложение 194360

lua:
script_name("AutoPiar")
script_author("ARMOR,Sanchez")
script_version("1.2")

require("lib.moonloader")
local ev = require('lib.samp.events')
local inicfg = require("inicfg")
local imgui = require("imgui")

local encoding = require('encoding')
encoding.default = 'CP1251'
u8 = encoding.UTF8

local font = renderCreateFont("Arial", 10, 9)
local cfg = inicfg.load({
    config = {
        vr = "",
        fam = "",
        j = "",
        s = "",
        ad = "",
    },
    interface = {
        vr_checkbox = false,
        fam_checkbox = false,
        j_checkbox = false,
        s_checkbox = false,
        ad_checkbox = false,
        vr_slider = 1,
        fam_slider = 1,
        j_slider = 1,
        s_slider = 1,
        ad_slider = 1,
        ad_radiobutton = 1,
        theme_id = 0,
    }
}, "AutoPiar.ini")

local enable = false

-- imgui window
local main_window_state = imgui.ImBool(false)

-- imgui checkbox
local vr_check = imgui.ImBool(cfg.interface.vr_checkbox)
local fam_check = imgui.ImBool(cfg.interface.fam_checkbox)
local j_check = imgui.ImBool(cfg.interface.j_checkbox)
local s_check = imgui.ImBool(cfg.interface.s_checkbox)
local ad_check = imgui.ImBool(cfg.interface.ad_checkbox)

-- imgui buffer
local vr = imgui.ImBuffer(''..cfg.config.vr,256)
local fam = imgui.ImBuffer(''..cfg.config.fam,256)
local j = imgui.ImBuffer(''..cfg.config.j,256)
local s = imgui.ImBuffer(''..cfg.config.s,256)
local ad = imgui.ImBuffer(''..cfg.config.ad,256)

-- imgui slider
local vr_slider = imgui.ImInt(cfg.interface.vr_slider)
local fam_slider = imgui.ImInt(cfg.interface.fam_slider)
local j_slider = imgui.ImInt(cfg.interface.j_slider)
local s_slider = imgui.ImInt(cfg.interface.s_slider)
local ad_slider = imgui.ImInt(cfg.interface.ad_slider)

-- imgui radiobutton
local ad_radiobutton = imgui.ImInt(cfg.interface.ad_radiobutton)

-- imgui combo
local themes_combo = imgui.ImInt(cfg.interface.theme_id)

-- other
local delay = 0.5

function main()
    while not isSampAvailable() do wait(100) end

    if not doesFileExist(getWorkingDirectory()..'\\config\\AutoPiar.ini') then inicfg.save(cfg, 'AutoPiar.ini') end

    sampAddChatMessage("[AutoPiar]: {FFFFFF}Скрипт загружен, для настройки введите /ap", 0x5CBCFF)
    sampAddChatMessage("[AutoPiar]: {FFFFFF}Отдельное спасибо: Sanchez", 0x5CBCFF)

    sampRegisterChatCommand("ap", function()
        main_window_state.v = not main_window_state.v
    end)

    while true do wait(0)
        imgui.Process = main_window_state.v

        lockPlayerControl(main_window_state.v or false)
        if enable and not vr_check.v and not fam_check.v and not j_check.v and not ad_check.v and not s_check.v then
            sampAddChatMessage("[AutoPiar]: {FFFFFF}Произошла ошибка, были сняты все CheckBox'ы ", triangle)
            enable = false
        end
    end
end

function piar()
    lua_thread.create(function()
        while enable do wait(0)
            if fam_check.v then
                sampSendChat("/fam " .. u8:decode(cfg.config.fam))
                wait(random(0,30)fam_slider.v*1000)
            end
            if j_check.v then
                sampSendChat("/j " .. u8:decode(cfg.config.j))
                wait(random(0,30)j_slider.v*1000)
            end
            if s_check.v then
                sampSendChat("/s " .. u8:decode(cfg.config.s))
                wait(random(0,10)s_slider.v*1000)
            end
            if vr_check.v then
                sampSendChat("/vr " .. u8:decode(cfg.config.vr))
                                wait(random(0, 60)vr_slider.v*1000)
            end
            if ad_check.v and cfg.interface.ad_radiobutton ~= 0 then -- Может и фиксану когда нибудь
                sampSendChat("/ad " .. u8:decode(cfg.config.ad))
                wait(300)
                sampSendDialogResponse(15346, 1, cfg.interface.ad_radiobutton, nil)
                wait(1000)
                sampCloseCurrentDialogWithButton(1)
                wait(1000)
                sampCloseCurrentDialogWithButton(1)
                wait(ad_slider.v*1000)
            end
        end
    end)
end

function ev.onShowDialog(id, style, title, b1, b2, text)
    if id == 25626 and vr_check.v and enable then --25626
        lua_thread.create(function()
            wait(50)
            sampSendDialogResponse(25627, 1, 1, -1)
            sampCloseCurrentDialogWithButton(1)
        end)
    end
end


local styles = {u8"Синий стиль", u8"Зеленый стиль", u8"Розовый стиль", u8"Оранжевый стиль"}
function imgui.OnDrawFrame()
    team()
    if main_window_state.v then
        local sw, sh = getScreenResolution()

        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(600, 475), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Авто Пиар", main_window_state, imgui.WindowFlags.NoResize)
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /vr")).x)/2)
        imgui.Text(u8"Пиар в /vr")
        if imgui.Checkbox("##1", vr_check) then
            cfg.interface.vr_checkbox = vr_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##2", vr) then
            cfg.config.vr = vr.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##3", vr_slider, 1, 600, u8' %.0f с') then
            cfg.interface.vr_slider = vr_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /fam")).x)/2)
        imgui.Text(u8"Пиар в /fam")
        if imgui.Checkbox("##4", fam_check) then
            cfg.interface.fam_checkbox = fam_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##5", fam) then
            cfg.config.fam = fam.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##6", fam_slider, 1, 600, u8'%.0f с') then
            cfg.interface.fam_slider = fam_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /j")).x)/2)
        imgui.Text(u8"Пиар в /j")
        if imgui.Checkbox("##7", j_check) then
            cfg.interface.j_checkbox = j_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##8", j) then
            cfg.config.j = j.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##9", j_slider, 1, 600, u8'%.0f с') then
            cfg.interface.j_slider = j_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /s")).x)/2)
        imgui.Text(u8"Пиар в /s")
        if imgui.Checkbox("##10", s_check) then
            cfg.interface.s_checkbox = s_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##11", s) then
            cfg.config.s = s.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##12", s_slider, 1, 600, u8'%.0f с') then
            cfg.interface.s_slider = s_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Пиар в /ad")).x)/2)
        imgui.Text(u8"Пиар в /ad")
        if imgui.Checkbox("##13", ad_check) then
            cfg.interface.ad_checkbox = ad_check.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(30)
        imgui.PushItemWidth(560)
        if imgui.InputText("##14", ad) then
            cfg.config.ad = ad.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.PushItemWidth(582)
        if imgui.SliderInt("##15", ad_slider, 1, 600, u8'%.0f с') then
            cfg.interface.ad_slider = ad_slider.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        if imgui.RadioButton(u8"Обычное объявление", ad_radiobutton, 1) then
            cfg.interface.ad_radiobutton = ad_radiobutton.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.SameLine(470)
        if imgui.RadioButton(u8"VIP объявление", ad_radiobutton, 2) then
            cfg.interface.ad_radiobutton = ad_radiobutton.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8("Цветовая тема окна")).x)/2)
        imgui.Text(u8"Цветовая тема окна")
        if imgui.Combo("##16", themes_combo, styles) then
            cfg.interface.theme_id = themes_combo.v
            inicfg.save(cfg, "AutoPiar.ini")
        end
        imgui.Separator()
        if imgui.Button(u8((enable  and 'Остановить' or 'Запустить')..' авто-пиар'), imgui.ImVec2(582, 20)) then
            enable = not enable
            if enable then
                piar()
            end
            if not(vr_check.v or fam_check.v or j_check.v or ad_check.v or s_check.v) then
                sampAddChatMessage("[AutoPiar]: {FFFFFF}Небыло выбрано ниодного варианта пиара!", triangle)
                enable = false
            else
                sampAddChatMessage('[AutoPiar]: {FFFFFF}Пиар '..(enable and "активирован!" or "деактивирован!"), triangle)
            end
        end
        imgui.End()
    end
end

function ev.onSendCommand(cmd)
    local result = cmd:match("^/vr (.+)")
    if result ~= nil then
        if process ~= nil and result ~= message then
            process:terminate()
            process = nil
        end
        if process == nil then
            finished, try = false, 1
            message = tostring(result)
            process = lua_thread.create(function()
                while not finished do
                    if sampGetGamestate() ~= 3 then
                        finished = true; break
                    end
                    if not sampIsChatInputActive() then
                        local rotate = math.sin(os.clock() * 3) * 90 + 90
                        local el = getStructElement(sampGetInputInfoPtr(), 0x8, 4)
                        local X, Y = getStructElement(el, 0x8, 4), getStructElement(el, 0xC, 4)
                        renderDrawPolygon(X + 10, Y + (renderGetFontDrawHeight(font) / 2), 20, 20, 3, rotate, 0xFFFFFFFF)
                        renderDrawPolygon(X + 10, Y + (renderGetFontDrawHeight(font) / 2), 20, 20, 3, -1 * rotate, triangle)
                        renderFontDrawText(font, message, X + 25, Y, -1)
                        renderFontDrawText(font, string.format(" [x%s]", try), X + 25 + renderGetFontDrawTextLength(font, message), Y, 0x40FFFFFF)
                    end
                    wait(0)
                end
                process = nil
            end)
        end
    end
end

function ev.onServerMessage(color, text)
    if text:find("%[%u+%] {%x+}[A-z0-9_]+%[" .. select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) .. "%]:.+") then
        finished = true
    end
    if text:find("^%[Ошибка%].*После последнего сообщения в этом чате нужно подождать") then
        lua_thread.create(function()
            wait(delay * 1000);
            sampSendChat("/vr " .. message)
            try = try + 1
        end)
        return false
    end
    if text:find("^Вы заглушены") or text:find("Для возможности повторной отправки сообщения в этот чат") then
        finished = true
    end
end
function team()
    local style = imgui.GetStyle()
    local clrs = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4
    style.Alpha = 1
    style.ChildWindowRounding = 0
    style.WindowRounding = 0
    style.GrabRounding = 0
    style.GrabMinSize = 12
    style.FrameRounding = 5
    if themes_combo.v == 0 then
        triangle = 0xFF002779
        clrs[clr.Text] = ImVec4(1, 1, 1, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(9.9998999303352e-07, 9.9999613212276e-07, 9.9999999747524e-07, 0)
        clrs[clr.PopupBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.Border] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.BorderShadow] = ImVec4(9.9999999747524e-07, 9.9998999303352e-07, 9.9998999303352e-07, 0)
        clrs[clr.FrameBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.FrameBgHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.FrameBgActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.TitleBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.TitleBgActive] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.MenuBarBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0.14883691072464, 0.14883720874786, 0.14883571863174, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.ComboBg] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.ButtonActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.Header] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.HeaderActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.Separator] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.14117647707462, 0.45098039507866, 0.82352942228317, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.062745101749897, 0.37254902720451, 0.74509805440903, 1)
        clrs[clr.ResizeGripActive] = ImVec4(0.10196078568697, 0.41176471114159, 0.7843137383461, 1)
        clrs[clr.CloseButton] = ImVec4(0.19607843458652, 0.19607843458652, 0.19607843458652, 0.88235294818878)
        clrs[clr.CloseButtonHovered] = ImVec4(0.19607843458652, 0.19607843458652, 0.19607843458652, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.19607843458652, 0.19607843458652, 0.19607843458652, 0.60784316062927)
        clrs[clr.PlotLines] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(1, 0.99999779462814, 0.99998998641968, 1)
        clrs[clr.PlotHistogram] = ImVec4(1, 0.99999779462814, 0.99998998641968, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(1, 0.9999960064888, 0.99998998641968, 1)
        clrs[clr.TextSelectedBg] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    elseif themes_combo.v == 1 then
        triangle = 0xFF007723
        clrs[clr.Text] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(0, 0, 0, 0)
        clrs[clr.PopupBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.Border] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.BorderShadow] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.FrameBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.FrameBgHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.58823531866074)
        clrs[clr.FrameBgActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.39215686917305)
        clrs[clr.TitleBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.82352942228317)
        clrs[clr.TitleBgActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.66666668653488)
        clrs[clr.MenuBarBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.58823531866074)
        clrs[clr.ComboBg] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.ButtonActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.Header] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.HeaderActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.Separator] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.7843137383461)
        clrs[clr.ResizeGripActive] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 0.70588237047195)
        clrs[clr.CloseButton] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 1)
        clrs[clr.CloseButtonHovered] = ImVec4(0.29019609093666, 0.29019609093666, 0.29019609093666, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.77209305763245, 0.77208530902863, 0.77208530902863, 0.7843137383461)
        clrs[clr.PlotLines] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.PlotHistogram] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(0.52941179275513, 0.70588237047195, 0.011764706112444, 1)
        clrs[clr.TextSelectedBg] = ImVec4(0.25581139326096, 0.25581139326096, 0.25581395626068, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    elseif themes_combo.v == 2 then
        triangle = 0xFFD6388B
        clrs[clr.Text] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(0, 0, 0, 0)
        clrs[clr.PopupBg] = ImVec4(0.70588237047195, 0.011764694936574, 0.37980872392654, 1)
        clrs[clr.Border] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.BorderShadow] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.FrameBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.FrameBgHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.58823531866074)
        clrs[clr.FrameBgActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.39215686917305)
        clrs[clr.TitleBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.82352942228317)
        clrs[clr.TitleBgActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.66666668653488)
        clrs[clr.MenuBarBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.58823531866074)
        clrs[clr.ComboBg] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.ButtonActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.Header] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.HeaderActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.Separator] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.7843137383461)
        clrs[clr.ResizeGripActive] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 0.70588237047195)
        clrs[clr.CloseButton] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 1)
        clrs[clr.CloseButtonHovered] = ImVec4(0.29019609093666, 0.29019609093666, 0.29019609093666, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.77209305763245, 0.77208530902863, 0.77208530902863, 0.7843137383461)
        clrs[clr.PlotLines] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.PlotHistogram] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(0.70588237047195, 0.011764706112444, 0.38039216399193, 1)
        clrs[clr.TextSelectedBg] = ImVec4(0.25581139326096, 0.25581139326096, 0.25581395626068, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    elseif themes_combo.v == 3 then
        triangle = 0xFFD67200
        clrs[clr.Text] = ImVec4(1, 0.99998998641968, 0.99998998641968, 1)
        clrs[clr.TextDisabled] = ImVec4(0.60000002384186, 0.60000002384186, 0.60000002384186, 1)
        clrs[clr.WindowBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ChildWindowBg] = ImVec4(0, 0, 0, 0)
        clrs[clr.PopupBg] = ImVec4(0.85116279125214, 0.59383445978165, 0, 1)
        clrs[clr.Border] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.BorderShadow] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.FrameBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.FrameBgHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.58823531866074)
        clrs[clr.FrameBgActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.39215686917305)
        clrs[clr.TitleBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.82352942228317)
        clrs[clr.TitleBgActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.TitleBgCollapsed] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.66666668653488)
        clrs[clr.MenuBarBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ScrollbarBg] = ImVec4(0, 0, 0, 1)
        clrs[clr.ScrollbarGrab] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ScrollbarGrabHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.ScrollbarGrabActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.58823531866074)
        clrs[clr.ComboBg] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.CheckMark] = ImVec4(1, 1, 1, 1)
        clrs[clr.SliderGrab] = ImVec4(0.1803921610117, 0.1803921610117, 0.1803921610117, 1)
        clrs[clr.SliderGrabActive] = ImVec4(0.258823543787, 0.258823543787, 0.258823543787, 1)
        clrs[clr.Button] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ButtonHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.ButtonActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.Header] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.HeaderHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.HeaderActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.Separator] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.SeparatorHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.SeparatorActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ResizeGrip] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.ResizeGripHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.7843137383461)
        clrs[clr.ResizeGripActive] = ImVec4(0.85490196943283, 0.59215688705444, 0, 0.70588237047195)
        clrs[clr.CloseButton] = ImVec4(9.9998999303352e-07, 9.9998999303352e-07, 9.9999999747524e-07, 1)
        clrs[clr.CloseButtonHovered] = ImVec4(0.29019609093666, 0.29019609093666, 0.29019609093666, 1)
        clrs[clr.CloseButtonActive] = ImVec4(0.77209305763245, 0.77208530902863, 0.77208530902863, 0.7843137383461)
        clrs[clr.PlotLines] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.PlotLinesHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.PlotHistogram] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.PlotHistogramHovered] = ImVec4(0.85490196943283, 0.59215688705444, 0, 1)
        clrs[clr.TextSelectedBg] = ImVec4(0.25581139326096, 0.25581139326096, 0.25581395626068, 0.34999999403954)
        clrs[clr.ModalWindowDarkening] = ImVec4(0.20000000298023, 0.20000000298023, 0.20000000298023, 0.34999999403954)
    end
end
function random(min, max) -- для рандома
    local kf = math.random(min, max)
    math.randomseed(os.time() * kf)
    local rand = math.random(min, max)
    return tonumber(rand)
end
Какое минимальное и максимальное значение должно быть в задержке?
 

izicapt

Известный
Автор темы
360
113
Какое минимальное и максимальное значение должно быть в задержке?
Именно то которое на картинке или в коде, а саму задержку устанавливает пользователь в imgui меню.
 

whyega52

Гений, миллионер, плейбой, долбаеб
Модератор
2,762
2,585

izicapt

Известный
Автор темы
360
113
Чет я запутался. Тебе надо чтобы рандом выставдял задержку или пользователь скрипта?
Пользователь выставил задержку и к этой задержке прибавляется N-ое (рандомное) количество секунд в деапозонах 0-60 например
Я вот чёт тоже не знаю как сделать такую штуку (именно как сложить)
 

whyega52

Гений, миллионер, плейбой, долбаеб
Модератор
2,762
2,585
Пользователь выставил задержку и к этой задержке прибавляется N-ое (рандомное) количество секунд в деапозонах 0-60 например
Я вот чёт тоже не знаю как сделать такую штуку (именно как сложить)
wait(random(0, 60) + (peremennaya.v*1000))
 
  • Нравится
Реакции: izicapt и YarikVL