Вопросы по AHK-скриптингу

андрееей

Известный
2
0
Здраствуйте.Треггер бот на красную точку для гта 5 РП все сервера.Скачал Нажимаю на Х игра сворачивается что не так,подскажите пожалуйста!?
AutoHotKey:
;цвет срабатывания (Hex, RGB):
Color = 0xFF0000

*~$x::
While GetKeyState("x", "P")
{
 PixelSearch,,, 959, 545, 960, 539, % Color,, Fast RGB
 If !ErrorLevel
 {
  Sleep, 15
  MouseClick
  ToolTip, Target triggered!, 150, 150
 }
 Else
 Sleep, 1    
}
ToolTip, No Target, 150, 150
Return
 

ice_ice

Участник
61
14
как сделать так , чтоб скрипт был активен если не активна англ раскладка?
 

Trawer2289

Известный
48
9
И снова здравствуйте, подскажите, пожалуйста, как сделать активацию активации части скрипта через gui, а сам скрипт по нажатию активированой активации?
У меня есть gui в которой есть CheckBox, если он не активирован, то при нажатии F2 ничего не произойдёт, а если в CheckBox`е стоит галочка, то после нажатия F2 скрипт будет работать.
1:
#InstallKeybdHook
#Persistent

Gui, Add, Checkbox, vMyCheckbox gMyCheckboxHandler, Активировать скрипт
Gui, Add, Button, default, Начать
Gui, Show

return

MyCheckboxHandler:
    ; Здесь можно вставить код, который будет выполняться при изменении состояния чекбокса
    ; Например, сохранение состояния чекбокса в переменной для использования в дальнейшем
return

ButtonStart:
    if MyCheckbox ; Проверяем состояние чекбокса
    {
        ; Здесь можно вставить код скрипта, который нужно запустить только при активированном чекбоксе
        ; Например:
        Send, {Enter}
    }
    else
    {
        MsgBox, Скрипт не будет запущен, так как чекбокс не активирован.
    }
return

Здраствуйте.Треггер бот на красную точку для гта 5 РП все сервера.Скачал Нажимаю на Х игра сворачивается что не так,подскажите пожалуйста!?
AutoHotKey:
;цвет срабатывания (Hex, RGB):
Color = 0xFF0000

*~$x::
While GetKeyState("x", "P")
{
 PixelSearch,,, 959, 545, 960, 539, % Color,, Fast RGB
 If !ErrorLevel
 {
  Sleep, 15
  MouseClick
  ToolTip, Target triggered!, 150, 150
 }
 Else
 Sleep, 1   
}
ToolTip, No Target, 150, 150
Return
Проблема в том, что вы не проверяете наличие цвета в определенной области экрана, а просто нажимаете на левую кнопку мыши. При этом программа не прекращает проверку наличия цвета в определенной области экрана при отпускании клавиши X.

как сделать так , чтоб скрипт был активен если не активна англ раскладка?
AutoHotKey:
#InstallKeybdHook
#Persistent

SetTimer, CheckKeyboardLayout, 1000

return

CheckKeyboardLayout:
    If GetKeyState("CapsLock", "T")
    {
        ; Здесь можно вставить код скрипта, который будет запускаться только при отсутствии английской раскладки
        ; Например:
        Send, {Enter}
    }
return

Как сделать, чтоб мой ахк скрипт после включения начинал работать в определённое время?
Включаю скрипт ----> время 10:20 ----> выполняется действие ----> скрипт ждёт 11:20.
AutoHotKey:
#InstallKeybdHook
#Persistent

SetTimer, CheckTime, 1000

return

CheckTime:
    currentTime := A_Hour ":" A_Min
    if (currentTime = "10:20")
    {
        ; Здесь можно вставить код действия, которое нужно выполнить в 10:20
        ; Например:
        Send, {Enter}
    }
    else if (currentTime = "11:20")
    {
        ExitApp
    }
return

У меня есть точка на экране на которую нужно переместить мышку, само окно с каждым разом меняет расширение. Как можно перемещать мышку на эту точку?
AutoHotKey:
#InstallKeybdHook
#Persistent

CoordMode, Mouse, Screen ; Устанавливаем координаты экрана для работы с мышью

SetTimer, MoveMouse, 1000 ; Устанавливаем таймер, который будет вызывать функцию MoveMouse каждую секунду

return

MoveMouse:
    ; Задаем координаты точки, на которую нужно переместить мышь
    targetX := 100
    targetY := 200

    ; Перемещаем мышь на указанную точку
    MouseMove, targetX, targetY
return

Приветствую форумчане, у меня одна проблема. Начну с моей цели. Моя цель была написать бота на шахту (для личного использования), я решил написать на питоне, там это дело было быстрым и не тяжелым. Питон быстро находил картинку, но действовал медленно, т.к язык сам по себе ну ооооочень медленный. Я решил подправить всё дело и написать на ахк, однако те же картинки которые питон спокойно находил, ахк не находит. В чем проблема? Вот пример картинки:
Посмотреть вложение 174626
AutoHotKey:
#InstallKeybdHook
#Persistent

CoordMode, Mouse, Screen ; Устанавливаем координаты экрана для работы с мышью

; Указываем путь к картинке, которую нужно найти
imagePath := "C:\path\to\image.png"

; Ищем картинку на экране
imageFound := ImageSearch, imageX, imageY, imageWidth, imageHeight, imagePath

; Если картинка была найдена, выводим ее координаты
if (imageFound)
{
    MsgBox, Картинка найдена
    MsgBox, % "X: " imageX " Y: " imageY
}
else
{
    MsgBox, Картинка не найдена
}

return
 
Последнее редактирование:
  • Нравится
Реакции: Vespan

ice_ice

Участник
61
14
1:
#InstallKeybdHook
#Persistent

Gui, Add, Checkbox, vMyCheckbox gMyCheckboxHandler, Активировать скрипт
Gui, Add, Button, default, Начать
Gui, Show

return

MyCheckboxHandler:
    ; Здесь можно вставить код, который будет выполняться при изменении состояния чекбокса
    ; Например, сохранение состояния чекбокса в переменной для использования в дальнейшем
return

ButtonStart:
    if MyCheckbox ; Проверяем состояние чекбокса
    {
        ; Здесь можно вставить код скрипта, который нужно запустить только при активированном чекбоксе
        ; Например:
        Send, {Enter}
    }
    else
    {
        MsgBox, Скрипт не будет запущен, так как чекбокс не активирован.
    }
return


Проблема в том, что вы не проверяете наличие цвета в определенной области экрана, а просто нажимаете на левую кнопку мыши. При этом программа не прекращает проверку наличия цвета в определенной области экрана при отпускании клавиши X.


AutoHotKey:
#InstallKeybdHook
#Persistent

SetTimer, CheckKeyboardLayout, 1000

return

CheckKeyboardLayout:
    If GetKeyState("CapsLock", "T")
    {
        ; Здесь можно вставить код скрипта, который будет запускаться только при отсутствии английской раскладки
        ; Например:
        Send, {Enter}
    }
return


AutoHotKey:
#InstallKeybdHook
#Persistent

SetTimer, CheckTime, 1000

return

CheckTime:
    currentTime := A_Hour ":" A_Min
    if (currentTime = "10:20")
    {
        ; Здесь можно вставить код действия, которое нужно выполнить в 10:20
        ; Например:
        Send, {Enter}
    }
    else if (currentTime = "11:20")
    {
        ExitApp
    }
return


AutoHotKey:
#InstallKeybdHook
#Persistent

CoordMode, Mouse, Screen ; Устанавливаем координаты экрана для работы с мышью

SetTimer, MoveMouse, 1000 ; Устанавливаем таймер, который будет вызывать функцию MoveMouse каждую секунду

return

MoveMouse:
    ; Задаем координаты точки, на которую нужно переместить мышь
    targetX := 100
    targetY := 200

    ; Перемещаем мышь на указанную точку
    MouseMove, targetX, targetY
return


AutoHotKey:
#InstallKeybdHook
#Persistent

CoordMode, Mouse, Screen ; Устанавливаем координаты экрана для работы с мышью

; Указываем путь к картинке, которую нужно найти
imagePath := "C:\path\to\image.png"

; Ищем картинку на экране
imageFound := ImageSearch, imageX, imageY, imageWidth, imageHeight, imagePath

; Если картинка была найдена, выводим ее координаты
if (imageFound)
{
    MsgBox, Картинка найдена
    MsgBox, % "X: " imageX " Y: " imageY
}
else
{
    MsgBox, Картинка не найдена
}

return
что то тут не так, сделал по твоему примеру и скрипт работает при любой раскладке и при англ и при других, но не работает если зажать шифт, а надо чтоб он в целом не работал пока стоит англ раскладка
 

Trawer2289

Известный
48
9
что то тут не так, сделал по твоему примеру и скрипт работает при любой раскладке и при англ и при других, но не работает если зажать шифт, а надо чтоб он в целом не работал пока стоит англ раскладка
AutoHotKey:
#If, GetKeyState("CapsLock", "T")

; Ваш скрипт AHK здесь

#If
 

dokuch

Новичок
1
0
кто может сделать АХК, чтобы АХК зажимало ЛКМ + через некоторое время нажимал С
 

dedmudryj

Новичок
14
0
ImageSearch в свернутом режиме, как сделать чтобы ахк считывало изображение со свернутой крмп? У меня есть бот на рыбалку с закрытым с сурсом на ахк, как сделать чтобы он работал если я сверну игру, мб его можно переписать на с++?
 

sqwwexx

Участник
64
1
ImageSearch в свернутом режиме, как сделать чтобы ахк считывало изображение со свернутой крмп? У меня есть бот на рыбалку с закрытым с сурсом на ахк, как сделать чтобы он работал если я сверну игру, мб его можно переписать на с++?
никак поиск изображения не будет работать в свернутом режиме)) особенно с закрытым кодом
 

Trawer2289

Известный
48
9
ImageSearch в свернутом режиме, как сделать чтобы ахк считывало изображение со свернутой крмп? У меня есть бот на рыбалку с закрытым с сурсом на ахк, как сделать чтобы он работал если я сверну игру, мб его можно переписать на с++?
AutoHotKey:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

; Set the path to the image you want to search for
imagePath := "C:\path\to\image.png"

; Set the search area and tolerance
x := 0
y := 0
w := 100
h := 100
tolerance := 0

; Search for the image
imageFound := ImageSearch(x, y, w, h, imagePath, tolerance)

; Check if the image was found
if (imageFound) {
    ; The image was found, so do something here
    MsgBox, The image was found!
} else {
    ; The image was not found, so do something here
    MsgBox, The image was not found.
}

кто может сделать АХК, чтобы АХК зажимало ЛКМ + через некоторое время нажимал С
AutoHotKey:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

; Clamp the LMB and press C after a while
LButton::
    MouseClick, left, , , 1, 0, D
    Sleep, 10000 ; Sleep for 10 seconds before pressing C
    Send, C
return
 

Sightless

Новичок
19
0
1671821237646.png
как находить эту базу от кс го для того чтоб работал ахк вх?
 

PAVLeK_

Новичок
4
0
Пацаны, скачал автопиар, мне нужно, чтобы вопрос о рекламе скрипт сам принимал, и реклама сразу в чат vr летела как реклама. Он просто вводит сообщение рекламы в чат, а диалог с вопросом оставляет открытым, как сделать так, чтобы он в диалоге (да) нажимал, там диалог конченый без строк каких то, просто две кнопки. Хелп пэжэ
скрипт:
script_name("AutoPiar")
script_author("ARMOR")
script_version("1.2")

require "lib.moonloader"
local imgui = require "imgui"
local inicfg = require "inicfg"
local font = renderCreateFont("Arial", 10, 9)
local encoding = require 'encoding'
local ev = require 'lib.samp.events'

encoding.default = 'CP1251'
u8 = encoding.UTF8

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(256)
local fam = imgui.ImBuffer(256)
local j = imgui.ImBuffer(256)
local s = imgui.ImBuffer(256)
local ad = imgui.ImBuffer(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(0)

-- other
local delay = 0.5

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    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}Отдельное спасибо: art creator", 0x5CBCFF)

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

    while true do
        wait(0)
        vr.v = cfg.config.vr
        fam.v = cfg.config.fam
        j.v = cfg.config.j
        s.v = cfg.config.s
        ad.v = cfg.config.ad
        themes_combo.v = cfg.interface.theme_id
        styles = cfg.interface.theme_id
        if main_window_state.v then
            lockPlayerControl(true)
        else
            lockPlayerControl(false)
        end
        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_fam()
    while enable do
        if fam_check.v == true then
            sampSendChat("/fam " .. u8:decode(cfg.config.fam))
        end
        wait(fam_slider.v*1000)
    end
end

function piar_j()
    wait(500)
    while enable do
        if j_check.v == true then
            sampSendChat("/j " .. u8:decode(cfg.config.j))
        end
        wait(j_slider.v*1000)
    end
end

function piar_s()
    wait(1000)
    while enable do
        if s_check.v == true then
            sampSendChat("/s " .. u8:decode(cfg.config.s))
        end
        wait(s_slider.v*1000)
    end
end

function piar_ad()
    wait(1500)
    while enable do
        if ad_check.v == true and cfg.interface.ad_radiobutton == 1 then
            sampSendChat("/ad " .. u8:decode(cfg.config.ad))
            wait(300)
            sampSendDialogResponse(15346, 1, 1, nil)
            sampCloseCurrentDialogWithButton(1)
            wait(500)
            sampCloseCurrentDialogWithButton(1)
        elseif ad_check.v == true and cfg.interface.ad_radiobutton == 2 then
            sampSendChat("/ad " .. u8:decode(cfg.config.ad))
            wait(300)
            sampSendDialogResponse(15346, 1, 2, nil)
            sampCloseCurrentDialogWithButton(1)
            wait(500)
            sampCloseCurrentDialogWithButton(1)
        end
        wait(ad_slider.v*1000)
    end
end

function piar_vr()
    wait(2300)
    while enable do
        if vr_check.v then
            sampSendChat("/vr " .. u8:decode(cfg.config.vr))
            wait(500)
                        Sendinput {enter}
                 end
            wait(vr_slider.v*1000)
        end
end


local sampev = require 'lib.samp.events'

function sampev.onShowDialog(id, style, title, b1, b2, text)
    if id == 25629 then
        lua_thread.create(function()
        wait(50)
        sampSendDialogResponse(25629, 1, 0, -1)
        sampCloseCurrentDialogWithButton(1)
        end)
    end
end




function imgui.OnDrawFrame()
    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 styles == 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 styles == 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 styles == 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 styles == 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
    
    local styles = {u8"Синий стиль", u8"Зеленый стиль", u8"Розовый стиль", u8"Оранджевый стиль"}

    if not main_window_state.v then
        imgui.Process = false
    end

    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
            styles = themes_combo.v
            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_vr1 = lua_thread.create(piar_vr)
                piar_fam2 = lua_thread.create(piar_fam)
                piar_j3 = lua_thread.create(piar_j)
                piar_s4 = lua_thread.create(piar_s)
                piar_ad5 = lua_thread.create(piar_ad)
            else
                if piar_vr1 then piar_vr1:terminate() end
                if piar_fam2 then piar_fam2:terminate() end
                if piar_j3 then piar_j3:terminate() end
                if piar_s4 then piar_s4:terminate() end
                if piar_ad5 then piar_ad5:terminate() end
            end
            if 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}Небыло выбрано ниодного варианта пиара!", triangle)
                enable = false
            else
                sampAddChatMessage(enable and "[AutoPiar]: {FFFFFF}Пиар активирован!" or "[AutoPiar]: {FFFFFF}Пиар деактивирован!", 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 finished == false 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
 

zKuk

Активный
150
59
Пацаны, скачал автопиар, мне нужно, чтобы вопрос о рекламе скрипт сам принимал, и реклама сразу в чат vr летела как реклама. Он просто вводит сообщение рекламы в чат, а диалог с вопросом оставляет открытым, как сделать так, чтобы он в диалоге (да) нажимал, там диалог конченый без строк каких то, просто две кнопки. Хелп пэжэ
скрипт:
script_name("AutoPiar")
script_author("ARMOR")
script_version("1.2")

require "lib.moonloader"
local imgui = require "imgui"
local inicfg = require "inicfg"
local font = renderCreateFont("Arial", 10, 9)
local encoding = require 'encoding'
local ev = require 'lib.samp.events'

encoding.default = 'CP1251'
u8 = encoding.UTF8

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(256)
local fam = imgui.ImBuffer(256)
local j = imgui.ImBuffer(256)
local s = imgui.ImBuffer(256)
local ad = imgui.ImBuffer(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(0)

-- other
local delay = 0.5

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    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}Отдельное спасибо: art creator", 0x5CBCFF)

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

    while true do
        wait(0)
        vr.v = cfg.config.vr
        fam.v = cfg.config.fam
        j.v = cfg.config.j
        s.v = cfg.config.s
        ad.v = cfg.config.ad
        themes_combo.v = cfg.interface.theme_id
        styles = cfg.interface.theme_id
        if main_window_state.v then
            lockPlayerControl(true)
        else
            lockPlayerControl(false)
        end
        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_fam()
    while enable do
        if fam_check.v == true then
            sampSendChat("/fam " .. u8:decode(cfg.config.fam))
        end
        wait(fam_slider.v*1000)
    end
end

function piar_j()
    wait(500)
    while enable do
        if j_check.v == true then
            sampSendChat("/j " .. u8:decode(cfg.config.j))
        end
        wait(j_slider.v*1000)
    end
end

function piar_s()
    wait(1000)
    while enable do
        if s_check.v == true then
            sampSendChat("/s " .. u8:decode(cfg.config.s))
        end
        wait(s_slider.v*1000)
    end
end

function piar_ad()
    wait(1500)
    while enable do
        if ad_check.v == true and cfg.interface.ad_radiobutton == 1 then
            sampSendChat("/ad " .. u8:decode(cfg.config.ad))
            wait(300)
            sampSendDialogResponse(15346, 1, 1, nil)
            sampCloseCurrentDialogWithButton(1)
            wait(500)
            sampCloseCurrentDialogWithButton(1)
        elseif ad_check.v == true and cfg.interface.ad_radiobutton == 2 then
            sampSendChat("/ad " .. u8:decode(cfg.config.ad))
            wait(300)
            sampSendDialogResponse(15346, 1, 2, nil)
            sampCloseCurrentDialogWithButton(1)
            wait(500)
            sampCloseCurrentDialogWithButton(1)
        end
        wait(ad_slider.v*1000)
    end
end

function piar_vr()
    wait(2300)
    while enable do
        if vr_check.v then
            sampSendChat("/vr " .. u8:decode(cfg.config.vr))
            wait(500)
                        Sendinput {enter}
                 end
            wait(vr_slider.v*1000)
        end
end


local sampev = require 'lib.samp.events'

function sampev.onShowDialog(id, style, title, b1, b2, text)
    if id == 25629 then
        lua_thread.create(function()
        wait(50)
        sampSendDialogResponse(25629, 1, 0, -1)
        sampCloseCurrentDialogWithButton(1)
        end)
    end
end




function imgui.OnDrawFrame()
    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 styles == 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 styles == 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 styles == 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 styles == 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
   
    local styles = {u8"Синий стиль", u8"Зеленый стиль", u8"Розовый стиль", u8"Оранджевый стиль"}

    if not main_window_state.v then
        imgui.Process = false
    end

    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
            styles = themes_combo.v
            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_vr1 = lua_thread.create(piar_vr)
                piar_fam2 = lua_thread.create(piar_fam)
                piar_j3 = lua_thread.create(piar_j)
                piar_s4 = lua_thread.create(piar_s)
                piar_ad5 = lua_thread.create(piar_ad)
            else
                if piar_vr1 then piar_vr1:terminate() end
                if piar_fam2 then piar_fam2:terminate() end
                if piar_j3 then piar_j3:terminate() end
                if piar_s4 then piar_s4:terminate() end
                if piar_ad5 then piar_ad5:terminate() end
            end
            if 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}Небыло выбрано ниодного варианта пиара!", triangle)
                enable = false
            else
                sampAddChatMessage(enable and "[AutoPiar]: {FFFFFF}Пиар активирован!" or "[AutoPiar]: {FFFFFF}Пиар деактивирован!", 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 finished == false 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
Тебе раздел в луа
 

UNKNXXWN

Известный
85
8
Мужики, нужна помощь, объясните как сделать ахк скрипт для сампа (он очень прост но я не умею просто)
Алгоритм прост
Сервер пишет в чат "У вас закончилась наживка ......."
И чтобы ахк на это реагировал как бы и сразу автоматически инвентарь открывал на кнопку i и закрывал его снова i
(Ну то есть тупо тыкал два раза и все, просто я использую одного бота для рыбалки и вся фишка в том что он не умеет открывать инвентарь, а с ахк я бы мог автоматизировать весь процесс)
 

Trawer2289

Известный
48
9
Мужики, нужна помощь, объясните как сделать ахк скрипт для сампа (он очень прост но я не умею просто)
Алгоритм прост
Сервер пишет в чат "У вас закончилась наживка ......."
И чтобы ахк на это реагировал как бы и сразу автоматически инвентарь открывал на кнопку i и закрывал его снова i
(Ну то есть тупо тыкал два раза и все, просто я использую одного бота для рыбалки и вся фишка в том что он не умеет открывать инвентарь, а с ахк я бы мог автоматизировать весь процесс)
AutoHotKey:
#NoEnv
#SingleInstance Force
#Persistent

SetTitleMatchMode, 2

ChatText = У вас закончилась наживка

SetTimer, OpenInventory, 3000

OpenInventory:
Send, i
Sleep, 100
Send, i
Return

OnMessage(ChatText, "OpenInventory")

OnMessage(message, command) {
    IfInString, message, %ChatText%
        {
            Run, %command%
        }
}