script_name("AutoPiar")
script_author("ARMOR")
script_version("1.0 release")
require "lib.moonloader"
local imgui = require "imgui"
local inicfg = require "inicfg"
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")
stat = { ['act'] = 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)
sampRegisterChatCommand("ap", cmd_imgui)
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 == true then
lockPlayerControl(true)
else
lockPlayerControl(false)
end
if stat['act'] == true and vr_check.v == false and fam_check.v == false and j_check.v == false and ad_check.v == false and s_check.v == false then
sampAddChatMessage("[AutoPiar]: {FFFFFF}Произошла ошибка, были сняты все CheckBox'ы ", 0x5CBCFF)
stat['act'] = false
end
end
end
function piar_fam()
while stat['act'] do
if fam_check.v == true then
sampSendChat("/fam " .. u8:decode(cfg.config.fam))
end
wait(fam_slider.v*60000)
end
end
function piar_j()
wait(500)
while stat['act'] do
if j_check.v == true then
sampSendChat("/j " .. u8:decode(cfg.config.j))
end
wait(j_slider.v*60000)
end
end
function piar_s()
wait(1000)
while stat['act'] do
if s_check.v == true then
sampSendChat("/s " .. u8:decode(cfg.config.s))
end
wait(s_slider.v*60000)
end
end
function piar_ad()
wait(1500)
while stat['act'] 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*60000)
end
end
function piar_vr()
wait(2300)
while stat['act'] do
if vr_check.v then
sampSendChat("/vr " .. vr.v)
end
if finished then
wait(vr_slider.v*60000)
sampAddChatMessage("Если ты видишь это сообщение, значит отчет работает", -1)
end
end
end
function cmd_imgui()
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
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
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
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
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
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, 10, 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, 10, 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, 10, 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, 10, 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, 10, 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((stat['act'] and 'Остановить' or 'Запустить')..' авто-пиар'), imgui.ImVec2(582, 20)) then
stat['act'] = not stat['act']
if stat['act'] 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 vr_check.v == false and fam_check.v == false and j_check.v == false and ad_check.v == false and s_check.v == false then
sampAddChatMessage("[AutoPiar]: {FFFFFF}Небыло выбрано ниодного варианта пиара!", 0x5CBCFF)
stat['act'] = false
else
sampAddChatMessage(stat['act'] and "[AutoPiar]: {FFFFFF}Пиар активирован!" or "[AutoPiar]: {FFFFFF}Пиар деактивирован!", 0x5CBCFF)
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, 0xFF0090FF)
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 not finished then
if text:find("^%[Ошибка%].*После последнего сообщения в этом чате нужно подождать") then
lua_thread.create(function()
wait(delay * 1000);
sampSendChat("/vr " .. message)
try = try + 1
end)
return false
end
local id = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))
if text:match("%[%u+%] {%x+}[A-z0-9_]+%[" .. id .. "%]:") then
finished = true
end
end
if text:find("^Вы заглушены") or text:find("Для возможности повторной отправки сообщения в этот чат") then
finished = true
end
end