local ffi = require('ffi')
local ImGui = require 'imgui'
local sampev = require "lib.samp.events"
local encoding = require 'encoding'
local inicfg = require 'inicfg'
local bit = require('bit')
local inFam = false
local inOrg = false
local distance2 = 0
local geok = ''
local colvovizovov = 0
local lastFireTime = 0
local processName = "gta_sa.exe"
local window2x = 100
local window2y = 100
local applyDragWindow = false
local window = 0
local WhFire = false
local NotStopStat = false
local money = 0
local lastmoney = 0
local moneyzabral = 0
local timer = '00:00:00'
local startTime = 0
local numberApply = -1
local texturegray = renderLoadTextureFromFile("moonloader\\fire2.png")
local texturered = renderLoadTextureFromFile("moonloader\\fire1.png")
local font = renderCreateFont("Arial", 13, 4)
local font2 = renderCreateFont("Arial", 8, 4)
local ImVec4 = ImGui.ImVec4
local spokoino = false
local vibor = false
local fulltextgeonew = ''
local countOfFires = 0
local fastVibor = false
local font3 = renderCreateFont("Arial", 24, true, {
weight = 50
})
local newfire = false
local newfiregeo = ""
local nowfires = {}
local foklm = true
local screenx, screeny = getScreenResolution()
local coordinatesFire = {
{ x = -2131.78515625, y = -223.33581542969, z = 35.690830230713, geoname = 'Пожар на фабрике около Центра лицензирования Сан Фиерро' },
{ x = -377.13531494141, y = 2173.8671875, z = 42.593635559082, geoname = 'Пожар в заброшенной деревне в округе Bone Country' },
{ x = 1258.1574707031, y = 67.378494262695, z = 23.01159286499, geoname = 'Падение самолёта в округе Red Country' },
{ x = 2685.2729492188, y = -225.18000793457, z = 34.696800231934, geoname = 'Пожар в округе Паломино крик' },
{ x = -68.214553833008, y = -1584.9287109375, z = 2.6171875, geoname = 'Возгорание в трейлер парке на выезде Лос Сантос - Сан Фиерро' },
{ x = -7.5185980796814, y = 1342.1552734375, z = 9.171875, geoname = 'Пожар в трейлер парке в округе Bone Country' },
{ x = -2615.6926269531, y = 2522.7731933594, z = 27.16286277771, geoname = 'Обвал на шоссе в округе Tierra Robada' },
{ x = 2112.7846679688, y = 2827.046875, z = 10.8203125, geoname = 'Пожар жилого дома в округе Emerald Isle' },
{ x = 2312.0390625, y = -2074.8146972656, z = 13.546875, geoname = 'Возгорание в округе индустриального района Лос Сантоса' },
{ x = 793.89294433594, y = 371.55053710938, z = 20.560718536377, geoname = 'Возгорание трейлера в округе Red Country' },
{ x = 258.16577148438, y = 1428.109375, z = 10.5859375, geoname = 'Возгорание 4 насоса на нефтезаводе Las Venturas Oil' },
{ x = -1747.5093994141, y = -136.90272521973, z = 3.5546875, geoname = 'Пожар в доках Сан Фиерро' },
{ x = 1664.9576416016, y = -333.77886962891, z = 40.258411407471, geoname = 'Обвал туннеля(возможны утечки газа) в районе шоссе Лос Сантос - Лас Вентурас' },
{ x = -913.84002685547, y = -241.38737487793, z = 38.015495300293, geoname = 'Обвал на дороге в округе Red Country' },
{ x = 697.36883544922, y = -1161.5048828125, z = 15.552696228027, geoname = 'Пожар жилого дома в районе теннисного клуба' },
{ x = 1348.6791992188, y = -1626.7326660156, z = 13.599992752075, geoname = 'Пожар жилого дома около банка Лос Сантоса' },
{ x = 810.51037597656, y = -1550.7216796875, z = 13.830481529236, geoname = 'Пожар складных помещений Toy Corner в районе торгового центра' },
}
encoding.default = "CP1251"
u8 = encoding.UTF8
local coordinatesStations = {
{ x = 1728.6527099609, y = -1478.8383789063, z = 13.466199874878, city = 'Los Santos' },
{ x = -2014.4799804688, y = 62.822101593018, z = 29.572799682617, city = 'San Fierro' },
{ x = 1764.3156738281, y = 2060.9450683594, z = 10.976599693298, city = 'Las Venturas' }
}
ffi.cdef [[
typedef int BOOL;
typedef unsigned long HANDLE;
typedef HANDLE HWND;
typedef int bInvert;
typedef int(__thiscall* get_clipboard_text_count)(void*);
typedef void(__thiscall* get_clipboard_text)(void*, int, const char*, int);
typedef void(__thiscall* set_clipboard_text)(void*, const char*, int);
HWND GetActiveWindow(void);
BOOL FlashWindow(HWND hWnd, BOOL bInvert);
]]
function apply_custom_style()
ImGui.SwitchContext()
local style = ImGui.GetStyle()
local colors = style.Colors
local clr = ImGui.Col
local ImVec4 = ImGui.ImVec4
local ImVec2 = ImGui.ImVec2
style.WindowPadding = ImGui.ImVec2(8, 8)
style.WindowRounding = 6
style.ChildWindowRounding = 5
style.FramePadding = ImGui.ImVec2(5, 3)
style.FrameRounding = 3.0
style.ItemSpacing = ImGui.ImVec2(5, 4)
style.ItemInnerSpacing = ImGui.ImVec2(4, 4)
style.IndentSpacing = 21
style.ScrollbarSize = 10.0
style.ScrollbarRounding = 13
style.GrabMinSize = 8
style.GrabRounding = 1
style.WindowTitleAlign = ImGui.ImVec2(0.5, 0.5)
style.ButtonTextAlign = ImGui.ImVec2(0.5, 0.5)
colors[clr.Text] = ImVec4(0.95, 0.96, 0.98, 1.00);
colors[clr.TextDisabled] = ImVec4(0.29, 0.29, 0.29, 1.00);
colors[clr.WindowBg] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.ChildWindowBg] = ImVec4(0.12, 0.12, 0.12, 1.00);
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94);
colors[clr.Border] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.BorderShadow] = ImVec4(1.00, 1.00, 1.00, 0.10);
colors[clr.FrameBg] = ImVec4(0.22, 0.22, 0.22, 1.00);
colors[clr.FrameBgHovered] = ImVec4(0.18, 0.18, 0.18, 1.00);
colors[clr.FrameBgActive] = ImVec4(0.09, 0.12, 0.14, 1.00);
colors[clr.TitleBg] = ImVec4(0.14, 0.14, 0.14, 0.81);
colors[clr.TitleBgActive] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51);
colors[clr.MenuBarBg] = ImVec4(0.20, 0.20, 0.20, 1.00);
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.39);
colors[clr.ScrollbarGrab] = ImVec4(0.36, 0.36, 0.36, 1.00);
colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00);
colors[clr.ScrollbarGrabActive] = ImVec4(0.24, 0.24, 0.24, 1.00);
colors[clr.ComboBg] = ImVec4(0.24, 0.24, 0.24, 1.00);
colors[clr.CheckMark] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.SliderGrab] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.SliderGrabActive] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.Button] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.ButtonHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.ButtonActive] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.Header] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.HeaderHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.HeaderActive] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.ResizeGrip] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.ResizeGripHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.ResizeGripActive] = ImVec4(1.00, 0.19, 0.19, 1.00);
colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16);
colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39);
colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 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(1.00, 0.21, 0.21, 1.00);
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.18, 0.18, 1.00);
colors[clr.TextSelectedBg] = ImVec4(1.00, 0.32, 0.32, 1.00);
colors[clr.ModalWindowDarkening] = ImVec4(0.26, 0.26, 0.26, 0.60);
end
local iniFilePath = getWorkingDirectory() .. '\\FireHelper.ini'
local function saveVariablesToIni()
local file = io.open(iniFilePath, 'w')
if file then
file:write('[FireHelper]\n')
file:write('WhFire=' .. tostring(WhFire) .. '\n')
file:write('window2x=' .. tostring(window2x) .. '\n')
file:write('window2y=' .. tostring(window2y) .. '\n')
file:close()
end
end
local function loadVariablesFromIni()
local file = io.open(iniFilePath, 'r')
if file then
for line in file:lines() do
local key, value = line:match('^%s*(.-)%s*=%s*(.-)%s*$')
if key and value then
if key == 'WhFire' then
WhFire = value == 'true'
elseif key == 'window2x' then
window2x = tonumber(value)
elseif key == 'window2y' then
window2y = tonumber(value)
end
end
end
file:close()
end
end
local ImGuiWindowFlags_NoTitleBar = bit.bor(1, 0)
local ImGuiWindowFlags_NoResize = bit.bor(1, 1)
local ImGuiWindowFlags_NoMove = bit.bor(1, 2)
local ImGuiWindowFlags_NoScrollbar = bit.bor(1, 3)
local ImGuiWindowFlags_NoScrollWithMouse = bit.bor(1, 4)
local ImGuiWindowFlags_NoCollapse = bit.bor(1, 5)
local ImGuiWindowFlags_AlwaysAutoResize = bit.bor(1, 6)
local showWindow2 = ImGui.ImBool(false)
local showWindow = ImGui.ImBool(false)
local radioButtonState = ImGui.ImBool(WhFire)
function main()
repeat wait(0) until isSampAvailable()
wait(1500)
window = ffi.C.GetActiveWindow()
sampRegisterChatCommand('firehelp', imguiopen)
msg('FireHelper загружен. Команда: /firehelp')
apply_custom_style()
loadVariablesFromIni()
while true do
wait(0)
if foklm then
kajdyi()
end
if newfire then
renderFontDrawText(font3, newfiregeo, screenx / 5, screeny / 1.3, 0xFFA60C0C)
if isKeyJustPressed(0x48) then
fastApply()
end
end
if WhFire then
local allObjects = getAllObjects()
for _, v in pairs(allObjects) do
local sampId = sampGetObjectSampIdByHandle(v)
local model = getObjectModel(v)
if (model == 18691 or model == 18690 or model == 18689 or model == 18692 or model == 18693 or model == 18694) and isObjectOnScreen(v) then
local _, x, y, z = getObjectCoordinates(v)
local x1, y1 = convert3DCoordsToScreen(x, y, z)
local x2, y2, z2 = getCharCoordinates(PLAYER_PED)
local x10, y10 = convert3DCoordsToScreen(x2, y2, z2)
local distance3 = getDistanceBetweenCoords3d(x, y, z, x2, y2, z2)
local distanceFormatted = string.format("%.1f", distance3)
if distance3 <= 25 then
renderDrawTexture(texturered, x1 - 70, y1 - 160, 180, 180, 0.0, -1)
renderFontDrawText(font, "Пожар", x1 - 8, y1, -1)
renderFontDrawText(font, distanceFormatted, x1 + 4.5, y1 - 16, -1)
else
renderDrawTexture(texturegray, x1 - 36, y1 - 100, 110, 110, 0.0, -1)
renderFontDrawText(font2, "Пожар", x1, y1, -1)
renderFontDrawText(font2, distanceFormatted, x1 + 6, y1 - 11, -1)
end
end
end
end
if applyDragWindow then
showCursor(true, true)
showWindow2.v = true
showWindow.v = false
window2x, window2y = getCursorPos()
if isKeyJustPressed(0x20) then
applyDragWindow = false
showWindow.v = true
msg('Позиция сохранена')
showCursor(false, false)
saveVariablesToIni()
end
end
if NotStopStat then
local currentTime = os.time()
local elapsedTime = currentTime - startTime
timer = formatTime(elapsedTime)
end
if showWindow.v then
spokoino = showWindow.v
ImGui.ShowCursor = true
elseif showWindow2.v then
ImGui.ShowCursor = false
end
if showWindow.v or showWindow2.v then
ImGui.Process = true
else
ImGui.Process = false
end
end
end
function imguiopen()
showWindow.v = not showWindow.v
nowfires = {}
end
function msg(text)
sampAddChatMessage('{DC143C}[FireHelper] {FFFFFF}' .. text, -1)
end
function fleshwin()
lua_thread.create(function()
wait(3000)
ffi.C.FlashWindow(window, true)
end)
end
function WallHackFire()
WhFire = not WhFire
end
function wins()
local window = ffi.C.GetActiveWindow()
msg('Исправил')
end
function sampev.onServerMessage(color, text)
if text:find("Поступил вызов:") then
fleshwin()
fulltextgeonew = text
local startIndex = string.find(text, "Поступил вызов: {FF6347}") + string.len("Поступил вызов: {FF6347}")
geok = string.sub(text, startIndex)
app = true
appp = true
for _, point in ipairs(coordinatesFire) do
if point.geoname == geok then
xx, yy, zz = getCharCoordinates(PLAYER_PED)
local distance = getDistanceBetweenCoords3d(xx, yy, zz, point.x, point.y, point.z)
distance = tonumber(string.format("%.3f", distance))
newfiregeo = (geok .. ". Расстояние: " .. distance .. "м.")
app = false
appp = false
newfire = true
waiting(5000)
return {color, (text .. '. Расстояние: ' .. distance .. 'м.')}
else
if app then
newfiregeo = (geok .. ". Расстояние: Неизвестно")
end
end
end
if appp then
newfire = true
waiting(5000)
return {color, (text .. '. Расстояние: ' .. 'Неизвестно.')}
end
sampSendChat('/fires')
end
if (text:find('Список пожаров можно открывать раз в 5 секунд')) then
return false
end
if text:find('Для просмотра происшествий нужно быть на дежурстве') then
nowfires = {}
return false
end
if text:find('На данный момент нет происшествий') then
nowfires = {}
return false
end
if text:find('Благодарим за службу! Заработано на этом вызове:') and NotStopStat then
txt = text:gsub("{.-}", "")
asd = money
if txt ~= nil then
newStr = txt:gsub("%D+", "")
if newStr ~= nil then
money = tonumber(newStr)
lastmoney = money
if money ~= 0 and money ~= asd then
realnumber = money - asd
colvovizovov = colvovizovov + 1
return {color, (string.gsub(text, "%d[%d,]*", formatNumber(realnumber)))}
end
end
end
elseif text:find('Благодарим за службу! Заработано на этом вызове:') then
txt = text:gsub("{.-}", "")
asd = lastmoney
if txt ~= nil then
newStr = txt:gsub("%D+", "")
if newStr ~= nil and newStr ~= '0' then
realnumber = lastmoney - asd
lastmoney = realnumber
return {color, formatNumber(string.gsub(text, "%d[%d,]*", realnumber))}
else
return false
end
end
end
if text:find('Ваша зарплата:') and NotStopStat then
txt = text:gsub("{.-}", "")
if txt ~= nil then
newStr = txt:gsub("%D+", "")
if newStr ~= nil then
moneyzabral = (tonumber(newStr)) + moneyzabral
money = 0
end
end
end
if text:find('Server close') or text:find('Сервер закрыл со') then
moneyzabral = moneyzabral + money
money = 0
lastmoney = 0
end
end
function findNearestPoint(playerX, playerY, playerZ, points)
local nearestPoint = nil
local minDistance = nil
for _, point in ipairs(points) do
local distance = getDistanceBetweenCoords3d(playerX, playerY, playerZ, point.x, point.y, point.z)
if minDistance == nil or distance < minDistance then
minDistance = distance
nearestPoint = point
end
end
return nearestPoint
end
function setWaypointToNearestStation()
playerX, playerY, playerZ = getCharCoordinates(PLAYER_PED)
local nearestPoint = findNearestPoint(playerX, playerY, playerZ, coordinatesStations)
if nearestPoint ~= nil then
placeWaypoint(nearestPoint.x, nearestPoint.y, nearestPoint.z)
msg('Поставил метку на пожарную станцию в городе ' .. nearestPoint.city)
end
end
function waiting(mm)
lua_thread.create(function()
wait(mm)
newfire = false
newfiregeo = ""
end)
end
function ImGui.BeforeDrawFrame()
if fontsize == nil then
fontsize = ImGui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\trebucbd.ttf', 30.0, nil, ImGui.GetIO().Fonts:GetGlyphRangesCyrillic())
end
end
function ImGui.OnDrawFrame()
local screenWidth, screenHeight = getScreenResolution()
local windowWidth = 300
local windowHeight = 200
local windowX = (screenWidth - windowWidth) / 2
local windowY = (screenHeight - windowHeight) / 2
if showWindow.v then
ImGui.SetNextWindowSize(ImGui.ImVec2(screenx / 3, screeny / 2.3), ImGui.Cond.FirstUseEver)
ImGui.SetNextWindowPos(ImGui.ImVec2(screenx / 3, screeny / 3), ImGui.Cond.FirstUseEver)
ImGui.Begin("FireHelper", showWindow)
if ImGui.CollapsingHeader(u8"Происшествия") then
ImGui.Indent()
local pppp = true
for i, nowfire in ipairs(nowfires) do
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8(nowfire)).x) / 2)
ImGui.Text(u8(nowfire))
local startIndex2 = string.find(nowfire, "]") + string.len("]")
local geok2 = string.sub(nowfire, startIndex2)
local start, finish = string.find(geok2, "|")
if start then
geok2 = string.sub(geok2, 1, start - 2)
else
geok2 = geok2
end
for _, point in ipairs(coordinatesFire) do
if (" " .. point.geoname) == geok2 then
xx2, yy2, zz2 = getCharCoordinates(PLAYER_PED)
distance2 = getDistanceBetweenCoords3d(xx2, yy2, zz2, point.x, point.y, point.z)
distance2 = tonumber(string.format("%.3f", distance2))
pppp = false
end
end
if pppp then
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8("Расстояние: Неизвестно")).x) / 2)
ImGui.Text(u8("Расстояние: Неизвестно"))
else
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8("Расстояние: " .. distance2 .. "м.")).x) / 2)
ImGui.Text(u8("Расстояние: " .. distance2 .. "м."))
end
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Принять/отменить вызов").x) / 2)
if ImGui.Button(u8"Принять/отменить вызов №" .. i) then
applyFire(i)
end
end
ImGui.Unindent()
end
if ImGui.CollapsingHeader(u8"WallHack на огонь") then
ImGui.Indent()
if WhFire then
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Выключить").x) / 2)
if ImGui.Button(u8"Выключить") then
WhFire = not WhFire
saveVariablesToIni()
end
else
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Включить").x) / 2)
if ImGui.Button(u8"Включить") then
WhFire = not WhFire
saveVariablesToIni()
end
end
ImGui.Unindent()
end
if ImGui.CollapsingHeader(u8"Cтатистика заработка") then
ImGui.Indent()
if showWindow2.v then
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Закрыть статистику").x) / 2)
if ImGui.Button(u8"Закрыть статистику") then
showWindow2.v = not showWindow2.v
end
else
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Открыть статистику").x) / 2)
if ImGui.Button(u8"Открыть статистику") then
showWindow2.v = not showWindow2.v
end
end
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Сброс статистики").x) / 2)
if ImGui.Button(u8"Сброс статистики") then
resetStat()
end
if NotStopStat then
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Остановить статистику").x) / 2)
if ImGui.Button(u8"Остановить статистику") then
toggleStopwatch()
end
else
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Запустить статистику").x) / 2)
if ImGui.Button(u8"Запустить статистику") then
toggleStopwatch()
end
end
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Поменять расположение статистики").x) / 2)
if ImGui.Button(u8"Поменять расположение статистики") then
msg('Нажмите на пробел чтобы закрепить позицию')
applyDragWindow = true
end
if inFam then
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8" Состою в прокаченной фаме").x) / 2)
if ImGui.Checkbox(u8"Состою в прокаченной фаме", ImGui.ImBool(true)) then
inFam = false
end
else
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8" Состою в прокаченной фаме").x) / 2)
if ImGui.Checkbox(u8"Состою в прокаченной фаме", ImGui.ImBool(false)) then
inFam = true
end
end
ImGui.Unindent()
end
if ImGui.CollapsingHeader(u8"Другое") then
ImGui.Indent()
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Поставить метку на ближайшую станцию").x) / 2)
if ImGui.Button(u8"Поставить метку на ближайшую станцию") then
setWaypointToNearestStation()
end
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(u8"Нажать если окно с игрой не мигает при вызове").x) / 2)
if ImGui.Button(u8"Нажать если окно с игрой не мигает при вызове") then
wins()
end
ImGui.Unindent()
end
ImGui.End()
end
if showWindow2.v then
ImGui.SetNextWindowSize(ImGui.ImVec2(screenx / 6, screeny / 5), ImGui.Cond.FirstUseEver)
ImGui.SetNextWindowPos(ImGui.ImVec2(window2x, window2y), ImGuiWindowFlags_AlwaysAutoResize)
ImGui.Begin(u8"Статистика заработка", showWindow2)
ImGui.PushFont(fontsize)
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(timer).x) / 2)
ImGui.Text(timer)
ImGui.PopFont()
if inFam then
ImGui.Text(u8'Заработано: ' .. formatNumber((money + moneyzabral) * 2) .. '$')
ImGui.Text(u8'Не забрал денег: ' .. formatNumber(money * 2).. '$')
else
ImGui.Text(u8'Заработано: ' .. formatNumber(money + moneyzabral) .. '$')
ImGui.Text(u8'Не забрал денег: ' .. formatNumber(money).. '$')
end
ImGui.Text(u8'Потушено вызовов: ' .. colvovizovov)
ImGui.End()
end
end
function sampev.onShowDialog(id, style, title, button1, button2, text)
if id == 1404 then
if not vibor and not fastVibor then
nowfires = {}
countOfFires = 0
for element in string.gmatch(text, "[^%[]+") do
table.insert(nowfires, ('[' .. string.gsub(element, "{.-}", "")))
end
sampCloseCurrentDialogWithButton(0)
return false
elseif vibor then
sampSendDialogResponse(id, 1, numberApply, nil)
sampCloseCurrentDialogWithButton(0)
return false
elseif fastVibor then
numberApply = -1
for element in string.gmatch(text, "[^%[]+") do
numberApply = numberApply + 1
end
sampSendDialogResponse(id, 1, numberApply, nil)
sampCloseCurrentDialogWithButton(0)
return false
end
end
if id == 1405 and (vibor or fastVibor) then
sampSendDialogResponse(id, 1, numberApply, nil)
sampCloseCurrentDialogWithButton(0)
vibor = false
fastVibor = false
return false
end
end
function sampGetListboxItemByText(text, plain)
if not sampIsDialogActive() then
return -1
end
plain = not (plain == false)
for i = 0, sampGetListboxItemsCount() - 1 do
if sampGetListboxItemText(i):find(text, 1, plain) then
return i
end
end
return -1
end
function applyFire(numberFire)
vibor = true
numberApply = numberFire - 1
end
function kajdyi()
if showWindow.v or vibor then
foklm = false
lua_thread.create(function()
sampSendChat('/fires')
wait(200)
foklm = true
end)
end
end
function resetStat()
money = 0
timer = '00:00:00'
startTime = os.time()
colvovizovov = 0
moneyzabral = 0
lastmoney = 0
end
function toggleStopwatch()
NotStopStat = not NotStopStat
if NotStopStat then
startTime = os.time()
end
end
function formatTime(seconds)
local hours = math.floor(seconds / 3600)
local minutes = math.floor((seconds % 3600) / 60)
local seconds = seconds % 60
return string.format("%02d:%02d:%02d", hours, minutes, seconds)
end
function fastApply()
if not showWindow.v then
fastVibor = true
vibor = false
sampSendChat('/fires')
end
end
function formatNumber(number)
local formatted = tostring(number)
local k = 1
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if k == 0 then
break
end
end
return formatted
end