require('lib.moonloader')
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local memory = require('memory')
local imgui = require('mimgui')
local win = imgui.new.bool(false)
local hphud = imgui.new.bool(false) -- наш фреймек
local flags = imgui.WindowFlags
local addons = require('ADDONS')
local cjc = require('carbJsonConfig')
local settings = {
onoffscript = imgui.new.bool(),
onoffhudfix = imgui.new.bool(),
onoffhphud = imgui.new.bool(),
colorhphud = imgui.new.float[3](),
addresses = {
0x58EB70,
0x58F58D,
0x866C94,
0x866C8C
},
}
local cef = require('CEF Events')
local sampev = require('lib.samp.events')
function sampev.onSendSpawn()
show_cef_notify('success', 'SQULoad', 'Скрипт Загружен', 1000)
end
function show_cef_notify(type, title, text, time)
local str = ('window.executeEvent(\'event.notify.initialize\', \'["%s", "%s", "%s", "%s"]\');'):format(type, title,
text, time)
local bs = raknetNewBitStream()
raknetBitStreamWriteInt8(bs, 17)
raknetBitStreamWriteInt32(bs, 0)
raknetBitStreamWriteInt32(bs, #str)
raknetBitStreamWriteString(bs, str)
raknetEmulPacketReceiveBitStream(220, bs)
raknetDeleteBitStream(bs)
end
local page = 1
imgui.OnFrame(function() return hphud[0] end, function(player) -- фреймек
imgui.Begin('##Window', hphud, flags.NoResize + flags.AlwaysAutoResize + flags.NoTitleBar)
imgui.Text(u8'Ти дурачок')
imgui.End()
end)
imgui.OnFrame(function() return win[0] end, function(player)
imgui.Begin('SQULoad', win, flags.NoResize + flags.AlwaysAutoResize)
if addons.HeaderButton(page == 1, u8 'Основное') then
page = 1
end
imgui.SameLine()
if addons.HeaderButton(page == 2, u8 'Патчи-Фиксы') then
page = 2
end
imgui.SameLine()
if addons.HeaderButton(page == 3, u8 'Информация') then
page = 3
end
if page == 1 then
if addons.ToggleButton(u8 'Включить скрипт', settings.onoffscript) then
settings()
show_cef_notify('info', 'SQULoad', 'Вы включили скрипт.', 1000)
end
elseif page == 2 then
if addons.ToggleButton(u8 'Включить HudFix', settings.onoffhudfix) then
settings()
memory.write(settings.addresses[1], 1, 1, true)
memory.write(settings.addresses[2], 1, 1, true)
memory.copy(settings.addresses[3], memory.strptr("$%d"), 6, true)
memory.copy(settings.addresses[4], memory.strptr("-$%d"), 6, true)
end
if addons.ToggleButton(u8 'Включить HPHud', settings.onoffhphud) then -- включаем фреймек
settings()
hphud[0] = not hphud[0] -- вклучили
imgui.OpenPopup('RedactorCHPHUD')
end
if imgui.BeginPopup('RedactorCHPHUD', flags.AlwaysAutoResize) then
if imgui.ColorPicker3(u8 '##1', settings.colorhphud, imgui.ColorEditFlags.NoSidePreview) then
settings()
end
end
elseif page == 3 then
imgui.Text(u8 'Тест')
end
imgui.End()
end)
function main()
while not isSampAvailable() do wait(0) end
cjc.load(getWorkingDirectory() .. "\\config\\sload.json", settings)
settings()
sampRegisterChatCommand('sl', function() win[0] = not win[0] end)
while true do wait(0) end
end