- 211
- 12
- Версия MoonLoader
- .026-beta
Пч не изменяет положения
Lua:
require "lib.moonloader"
require "lib.moonloader"
local imgui = require 'imgui'
local encoding = require 'encoding'
local inicfg = require 'inicfg'
local samp = require 'samp.events'
local key = require('vkeys')
encoding.default = 'CP1251'
u8 = encoding.UTF8
local color_dialog = 0xDEB887
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)
local config = imgui.ImBool(false)
local dirIni="moonloader/config/timer.ini"
local mainIni = inicfg.load({
pos = {pos_x=800,pos_y=750},
config =
{
rang = false
}
}, 'timer.ini')
if not doesFileExist("moonloader/config/timer.ini") then inicfg.save(mainIni, "timer.ini") end
local i = 0
local sw, sh = getScreenResolution()
local main_window_state = imgui.ImBool(false)
function samp.onServerMessage(color, text)
if text:find("fff") then
if i>10 then
return true
end
i=11
timer()
end
end
function main()
Font = renderCreateFont("Molot", 12, 12)
if not isSampLoaded() and not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand('123', cmd_test)
imgui.Process = false
while true do
wait(0)
if i>0 then
renderFontDrawText(Font,'Privet'..i, mainIni.pos.pos_x, mainIni.pos.pos_y, -1)
end
end
showCursor(true, true)
local int_posX, int_posY = getCursorPos()
mainIni.pos.pos_x = int_posX
mainIni.pos.pos_y = int_posY
if isKeyJustPressed(13) then
showCursor(false, false)
sampAddChatMessage(u"Положение {fff000}сохранено.", -1)
changePos = false
inicfg.save(mainIni, 'timer.ini')
settings.v = true
imgui.Process = true
end
end
function cmd_test()
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
ScreenX, ScreenY = getScreenResolution()
imgui.SetNextWindowSize(imgui.ImVec2(252, 200), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2(ScreenX / 2, ScreenY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.Begin("CD settings", config, imgui.WindowFlags.NoResize + imgui.WindowFlags.AlwaysAutoResize)
imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(u8"Изменить положение").x) / 2)
if imgui.Button(u8'Изменить положение', imgui.ImVec2(imgui.CalcTextSize(u8"Изменить положение").x + 6, 20)) then config.v = false changePosition() end
end
imgui.End()
end
function changePosition()
if changePos==true then
changePos=false
else
changePos=true
sampAddChatMessage("Для сохранения положения нажмите {fff000}ENTER.", -1)
end
end
function timer()
lua_thread.create(
function()
while i>0 do
wait(1000)
i=i -1
end
end
)
end