- 11
- 0
Форматирование кода
Привет, хотел добавить новый сундук в боте /rlta, не получается добавить сундук "Сундук Лос Сантоса" Кто шарит хорошо, помогите пж.
КОД:
Lua:
local use = false
local close = false
local use1 = false
local close1 = false
require "lib.moonloader"
local samp = require 'samp.events'
local key = require 'vkeys'
local imgui = require 'imgui'
local encoding = require("encoding")
encoding.default = 'CP1251'
u8 = encoding.UTF8
local sw, sh = getScreenResolution()
local checked_test = imgui.ImBool(false)
local checked_test2 = imgui.ImBool(false)
local checked_test3 = imgui.ImBool(false)
local checked_test4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local zadervka = imgui.ImInt(1)
local zadervka1 = imgui.ImInt(1)
local zadervka2 = imgui.ImInt(1)
local zadervka3 = imgui.ImInt(1)
function main()
while not isSampAvailable() do wait(0) end wait(1)
sampRegisterChatCommand('rlta', rlta)
print('{ffffff}јвтор - rlta {fff000}FooOoott')
while true do
wait(0)
if checked_test.v then
sampSendClickTextdraw(65535)
wait(355)
active = true
sampSendChat("/invent")
wait(zadervka.v*60000)
end
if checked_test2.v then
sampSendClickTextdraw(65535)
wait(355)
active1 = true
sampSendChat("/invent")
wait(zadervka1.v*60000)
end
if checked_test3.v then
sampSendClickTextdraw(65535)
wait(355)
active2 = true
sampSendChat("/invent")
wait(zadervka2.v*60000)
end
if checked_test4.v then
sampSendClickTextdraw(65535)
wait(355)
active3 = true
sampSendChat("/invent")
wait(zadervka3.v*60000)
end
if checked_test5.v then
sampSendClickTextdraw(65535)
wait(355)
active4 = true
sampSendChat("/invent")
wait(zadervka3.v*60000)
end
end
end
function imgui.TextQuestion(text)
imgui.TextDisabled(u8'(?)')
if imgui.IsItemHovered() then
imgui.BeginTooltip()
imgui.PushTextWrapPos(450)
imgui.TextUnformatted(text)
imgui.PopTextWrapPos()
imgui.EndTooltip()
end
end
function rlta(arg)
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function imgui.OnDrawFrame()
if not main_window_state.v then
imgui.Process = false
end
if main_window_state.v then
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2 , sh / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver)
imgui.Begin(u8"—борщик рулеток", main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
imgui.Checkbox(u8'јктиваци¤', checked_test)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ обычного сундука')
imgui.Checkbox(u8'јктиваци¤##2', checked_test2)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ донатного сундука')
imgui.Checkbox(u8'јктиваци¤##3', checked_test3)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ платинового сундука')
imgui.Checkbox(u8'јктиваци¤##4', checked_test4)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ тaйник лос сантоса')
imgui.Checkbox(u8'јктиваци¤##5', checked_test5)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ сундука »лона')
imgui.SliderInt(u8'«адержка ',zadervka,5, 5)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ обычного сундука')
imgui.SliderInt(u8'«адержка##2 ',zadervka1,5, 5)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ донатного сундука')
imgui.SliderInt(u8'«адержка##3 ',zadervka2,5, 5)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ платинового сундука')
imgui.SliderInt(u8'«адержка##4 ',zadervka3,5, 5)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ тaйник лос сантоса')
imgui.SliderInt(u8'«адержка##5 ',zadervka3,5, 5)
imgui.SameLine()
imgui.TextQuestion(u8'ƒл¤ сундука »лона')
if imgui.Button('BugFix') then
sampAddChatMessage('{66ff66}Fixed. {FFB140}»спользуйте {66ff66}/rlta {FFB140}чтобы открыть окно и/или убрать курсор.', 0x66ff66)
thisScript():reload()
end
imgui.End()
end
end
function samp.onShowTextDraw(id, data)
if checked_test.v and active then
lua_thread.create(function()
if data.modelId == 19918 then
wait(111)
sampSendClickTextdraw(id)
use = true
end
if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use then
clickID = id + 1
sampSendClickTextdraw(clickID)
use = false
close = true
end
if close then
wait(111)
sampSendClickTextdraw(65535)
close = false
active = false
end
end)
end
if checked_test2.v and active1 then
lua_thread.create(function()
if data.modelId == 19613 then
wait(111)
sampSendClickTextdraw(id)
use1 = true
end
if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use1 then
clickID = id + 1
sampSendClickTextdraw(clickID)
use1 = false
close1 = true
end
if close1 then
wait(111)
sampSendClickTextdraw(65535)
close1 = false
active1 = false
end
end)
end
if checked_test3.v and active2 then
lua_thread.create(function()
if data.modelId == 1353 then
wait(111)
sampSendClickTextdraw(id)
use2 = true
end
if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use2 then
clickID = id + 1
sampSendClickTextdraw(clickID)
use2 = false
close2 = true
end
if close2 then
wait(111)
sampSendClickTextdraw(65535)
close2 = false
active2 = false
end
end)
end
if checked_test4.v and active3 then
lua_thread.create(function()
if data.modelId == 1733 then
wait(111)
sampSendClickTextdraw(id)
use3 = true
end
if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
clickID = id + 1
sampSendClickTextdraw(clickID)
use3 = false
close3 = true
end
if close3 then
wait(111)
sampSendClickTextdraw(65535)
close3 = false
active3 = false
end
end)
end
if checked_test5.v and active3 then
lua_thread.create(function()
if data.modelId == 1733 then
wait(111)
sampSendClickTextdraw(id)
use3 = true
end
if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
clickID = id + 1
sampSendClickTextdraw(clickID)
use3 = false
close3 = true
end
if close3 then
wait(111)
sampSendClickTextdraw(65535)
close3 = false
active3 = false
end
end)
end
end
function apply_custom_style()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.WindowRounding = 2.0
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
style.ChildWindowRounding = 2.0
style.FrameRounding = 2.0
style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
style.ScrollbarSize = 13.0
style.ScrollbarRounding = 0
style.GrabMinSize = 8.0
style.GrabRounding = 1.0
colors[clr.FrameBg] = ImVec4(0.48, 0.16, 0.16, 0.54)
colors[clr.FrameBgHovered] = ImVec4(0.98, 0.26, 0.26, 0.40)
colors[clr.FrameBgActive] = ImVec4(0.98, 0.26, 0.26, 0.67)
colors[clr.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.48, 0.16, 0.16, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.CheckMark] = ImVec4(0.98, 0.26, 0.26, 1.00)
colors[clr.SliderGrab] = ImVec4(0.88, 0.26, 0.24, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.98, 0.26, 0.26, 1.00)
colors[clr.Button] = ImVec4(0.98, 0.26, 0.26, 0.40)
colors[clr.ButtonHovered] = ImVec4(0.98, 0.26, 0.26, 1.00)
colors[clr.ButtonActive] = ImVec4(0.98, 0.06, 0.06, 1.00)
colors[clr.Header] = ImVec4(0.98, 0.26, 0.26, 0.31)
colors[clr.HeaderHovered] = ImVec4(0.98, 0.26, 0.26, 0.80)
colors[clr.HeaderActive] = ImVec4(0.98, 0.26, 0.26, 1.00)
colors[clr.Separator] = colors[clr.Border]
colors[clr.SeparatorHovered] = ImVec4(0.75, 0.10, 0.10, 0.78)
colors[clr.SeparatorActive] = ImVec4(0.75, 0.10, 0.10, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.98, 0.26, 0.26, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.98, 0.26, 0.26, 0.67)
colors[clr.ResizeGripActive] = ImVec4(0.98, 0.26, 0.26, 0.95)
colors[clr.TextSelectedBg] = ImVec4(0.98, 0.26, 0.26, 0.35)
colors[clr.Text] = ImVec4(1.00, 1.00, 1.00, 1.00)
colors[clr.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94)
colors[clr.ChildWindowBg] = ImVec4(1.00, 1.00, 1.00, 0.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.ComboBg] = colors[clr.PopupBg]
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53)
colors[clr.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00)
colors[clr.CloseButton] = ImVec4(0.41, 0.41, 0.41, 0.50)
colors[clr.CloseButtonHovered] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.CloseButtonActive] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
apply_custom_style()
Последнее редактирование модератором: