require("lib.moonloader")
local se = require("lib.samp.events")
local imgui = require('mimgui')
local encoding = require('encoding')
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local new = imgui.new
local mineMenu = new.bool(false)
local MINEstats = new.bool(false)
imgui.OnFrame(function() return mineMenu[0] end, function(player)
imgui.SetNextWindowPos(imgui.ImVec2(500,500), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(245, 270), imgui.Cond.Always)
imgui.Begin(u8'Помощник для шахты', mineMenu, imgui.WindowFlags.NoResize)
if imgui.Button(u8' Вывод статики добычи', imgui.ImVec2(-1, 30)) then
MINEstats[0] = not(MINEstats[0])
end
imgui.End()
end)
imgui.OnFrame(function() return MINEstats[0] end, function(player)
imgui.SetNextWindowPos(imgui.ImVec2(500,500), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.Begin(u8'Stata', MINEstats)
imgui.Text(u8'Собрано камня: ' .._G['stone'] or 0)
imgui.Text(u8'Собрано металла: ' .._G['metal'] or 0)
imgui.Text(u8'Собрано бронзы: ' .._G['bronze'] or 0)
imgui.Text(u8'Собрано серебра: ' .._G['silver'] or 0)
imgui.Text(u8'Собрано золота: ' .._G['gold'] or 0)
imgui.End()
end)
function se.onDisplayGameText(style, tm, text)
local mater, num = string.match(text, '(%D+) %+ (%d+)')
local material, number = string.lower(mater or 'stone'), tonumber(num) or 0
_G[material] = _G[material] and _G[material] + number or number
end
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand('mine', function()
mineMenu[0] = not mineMenu[0]
end)
wait(-1)
end