Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script_version"1.0"
- script_author"Glade"
- -- Подрубаем библиотеки
- require "lib.moonloader"
- local GK = require 'game.keys'
- local sampev = require 'lib.samp.events'
- local keys = require "vkeys"
- local cjson = require"cjson"
- local imgui = require 'imgui'
- inicfg = require 'inicfg'
- effil = require"effil"
- ffi = require 'ffi'
- local encoding = require"encoding"
- dlstatus = require('moonloader').download_status
- encoding.default = "cp1251"
- local vkeys = require 'vkeys'
- local wm = require 'lib.windows.message'
- local rkeys = require 'rkeys'
- imgui.HotKey = require('imgui_addons').HotKey
- imgui.ToggleButton = require("imgui_addons").ToggleButton
- u8 = require("encoding").UTF8
- ----------------------------------------------------------
- local main_window_state = imgui.ImBool(false)
- local tab = {
- false,
- false,
- }
- update_ok = false
- startwork_ok = false
- my_lvl_adm = 0
- admchecker_adminList = {{"checking..", 1}}
- admchecker_timerForCheck = 3000
- scores = {}
- check_lvl_admbool = false
- admchecker_adminList_forCMD = {}
- nameINI = "RodinaTools.ini"
- admchecker_recon_text = ""
- admchecker_nick_text = ""
- admchecker_helpmark = false
- hide_imguiCursor = true
- admchecker_CheckList = false
- admchecker_auth = false
- admchecker_SortingList = false
- admchecker_SortingTime = 0
- serverIPandPort_auth = false
- authorization = false
- check_my_lvlAdm = false
- recon_ID = 0
- recon_checkstats = false
- recon_status = false
- recon_getipCheck = false
- recon_getipCheck = false
- recon_cmdWeap = false
- LIP = {}
- CarName = {
- "Mercedes Gl63", -- 400
- "Volkswagen Bus", -- 401
- "Mercedes E63", -- 402
- "SCANIA", -- 403
- "Renault Megane", -- 404
- "Audi A6", -- 405
- "ZIL", -- 406
- "FireTruck",
- "TrashMaster", -- 408
- "Porsche Panamera",
- "Audi S8",
- "Daewoo Lanos",
- "Volvo 850",
- "Amry Bus",
- "Long Bus",
- "BMW M6", -- 415
- "Ambulance", -- 416
- "Leviathan", -- 417
- "Volkswagen Bus", -- 418
- "Citroen C4",
- "Renault Megane (Taxi)",
- "Mercedes 560 Sel",
- "Loaf",
- "Ice Cream Van",
- "Oka",
- "Military helicopter",
- "Lexus gs350",
- "Gazel (Police)",
- "Gazel (Incasator)",
- "Mercedes A45",
- "Boat (Police)",
- "Bus",
- "Tank",
- "Katyusha",
- "Hotknife", -- 434
- "Trailer (X)",
- "Mercedes CLS",
- "Bus",
- "Audi Rs5",
- "Lada 112",
- "Gazel",
- "RCBandit", -- 441
- "Zhiguli 1300",
- "Packer", -- 443
- "Monster",
- "Volkswagen Passat",
- "Squalo", -- 446
- "Seasparrow", -- 447
- "Pizzaboy", -- 448
- "Tram (X)", -- 449
- "Trailer (X)", -- 450
- "Lamborgini Huracan",
- "Speeder",
- "Reefer", -- 453
- "Tropic", -- 454
- "Flatbed", -- 455
- "Hlebovozka", -- 456
- "Caddy", -- 457
- "Volga",
- "Ford Transit",
- "CCCP-03735",
- "Kawasaki (low)",
- "Faggio", -- 462
- "Freeway", -- 463
- "RCBaron",
- "RCRaider",
- "BMW M5",
- "Lada 2107",
- "Sanchez", -- 468
- "Robinson",
- "Hummer H1",
- "Quad", -- 471
- "Coastguard",
- "Dinghy",
- "Lada Samara",
- "BMW X5M",
- "Rustler (X)", -- 477
- "BMW M4",
- "Walton",
- "Lada Westa",
- "Porsche Cayman",
- "BMX",
- "Mercedes Vito",
- "Paz",
- "Yacht",
- "Volga (AirFloat)",
- "Dozer", -- 486
- "Maverick",
- "NewsChopper",
- "Lexus LX570",
- "Range Rover",
- "Mercedes E320",
- "Lada Samara 1500",
- "Jetmax",
- "BMW I8",
- "Ford Raptor",
- "Skoda Rapid",
- "Maverick (Police)",
- "Boxvillde",
- "Gazon",
- "UAZ Patriot",
- "RCGoblin",
- "Tesla Model S",
- "Ford Mustang GT",
- "Dodge SRT",
- "Toyota Land Cruiser",
- "Audi R8",
- "Chevrolet Cruze",
- "Zaz (Buhanka)", -- 508
- "Bike", -- 509
- "MountainBike", -- 510
- "Beagle", -- 511
- "Cropduster", -- 512
- "Stunt",
- "Volvo FH12", -- 514
- "Mercedes Actros",
- "Ford Focus",
- "Majestic",
- "Buccaneer", -- 518
- "Shamal",
- "hydra",
- "Jupiter",
- "Yamaha",
- "HPV1000 (Police)",
- "CementTruck", -- 524
- "TowTruck", -- 525
- "Opel Monza", -- 526
- "Lada Pro Sport",
- "Grobovozka",
- "BMW M5",
- "Forklift",
- "Tractor", -- 531
- "Combine",
- "BMW M3",
- "Volkswagen Polo",
- "Porsche Cayenne",
- "Audi RS6",
- "Freight (X)",
- "Streak (X)",
- "Vortex",
- "Lada Priora",
- "Mercedes AMG GT",
- "Lada Niva",
- "Mercedes SL65",
- "Firetruck",
- "Zhiguli 2106",
- "Combi",
- "KIA Ceed",
- "Mi28",
- "Zaporozhec",
- "Hyunday Elantra",
- "Honda Accord",
- "Utility", -- 552
- "Nevada", -- 553
- "Gazel",
- "Zaporozhec",
- "Monster",
- "Monster",
- "Honda Civic", -- 558
- "Rolls-Royce Wraith", -- 559
- "Audi RS7",
- "Moscvich",
- "Nissan GTR",
- "Raindance",
- "RCTiger", -- 564
- "Lada Samara 1500",
- "Zhiguli 1500",
- "Toyota Camry",
- "Bac Mono",
- "FreightFlat (X)",
- "StreakCarriage (X)",
- "Kart", -- 571
- "Mower",
- "Mercedes G65 6x6", -- 573
- "Sweeper",
- "Broadway",
- "Moscvich", -- 576
- "AT-400",
- "Ural",
- "Mercedes G65",
- "Mercedes C63",
- "Kawasaki (medium)", -- 581
- "NewsVan",
- "Tug",
- "Trailer (X)", -- 584
- "Mercedes Maybach",
- "Wayfarer", -- 586
- "Mercedes S63",
- "Hotdog",
- "Volkswagen Sirocco",
- "FreightBox (X)",
- "Trailer (X)",
- "Andromada",-- 592
- "Dodo", -- 593
- "RCCam (X)", -- 594
- "Launch",
- "Audi A6 (police)",
- "Skoda Octavia (Police)",
- "Ford Focus (Police)",
- "UAZ Hunter (Police)",
- "Picador",
- "BTR",
- "BMW M2",
- "Mercedes C63",
- "DestroyCar",
- "SpaceCar", -- 605
- "Luggage A (X)", -- 606
- "Luggage B (X)", -- 607
- "Stairs (X)", -- 608
- "Boxville", -- 609
- "Tiller (X)",
- "UtilityTrailer (X)"
- }
- function asyncHttpRequest(method, url, args, resolve, reject)
- local request_thread = effil.thread(function(method, url, args)
- local requests = require"requests"
- local result, response = pcall(requests.request, method, url, args)
- if result then
- response.json, response.xml = nil, nil
- return true, response
- else
- return false, response
- end
- end)(method, url, args)
- if not resolve then
- resolve = function() end
- end
- if not reject then
- reject = function() end
- end
- lua_thread.create(function()
- local runner = request_thread
- while true do
- local status, err = runner:status()
- if not err then
- if status == "completed" then
- local result, response = runner:get()
- if result then
- resolve(response)
- else
- reject(response)
- end
- return
- elseif status == "canceled" then
- return reject(status)
- end
- else
- return reject(err)
- end
- wait(0)
- end
- end)
- end
- function distance_cord(lat1, lon1, lat2, lon2)
- if lat1 == nil or lon1 == nil or lat2 == nil or lon2 == nil or lat1 == "" or lon1 == "" or lat2 == "" or lon2 == "" then
- return 0
- end
- local dlat = math.rad(lat2 - lat1)
- local dlon = math.rad(lon2 - lon1)
- local sin_dlat = math.sin(dlat / 2)
- local sin_dlon = math.sin(dlon / 2)
- local a =
- sin_dlat * sin_dlat + math.cos(math.rad(lat1)) * math.cos(
- math.rad(lat2)
- ) * sin_dlon * sin_dlon
- local c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
- local d = 6378 * c
- return d
- end
- --HOOKS
- local hook = {hooks = {}}
- addEventHandler('onScriptTerminate', function(scr)
- if scr == script.this then
- for i, hook in ipairs(hook.hooks) do
- if hook.status then
- hook.stop()
- end
- end
- end
- end)
- ffi.cdef [[
- int VirtualProtect(void* lpAddress, unsigned long dwSize, unsigned long flNewProtect, unsigned long* lpflOldProtect);
- ]]
- function hook.new(cast, callback, hook_addr, size)
- local size = size or 5
- local new_hook = {}
- local detour_addr = tonumber(ffi.cast('intptr_t', ffi.cast('void*', ffi.cast(cast, callback))))
- local void_addr = ffi.cast('void*', hook_addr)
- local old_prot = ffi.new('unsigned long[1]')
- local org_bytes = ffi.new('uint8_t[?]', size)
- ffi.copy(org_bytes, void_addr, size)
- local hook_bytes = ffi.new('uint8_t[?]', size, 0x90)
- hook_bytes[0] = 0xE9
- ffi.cast('uint32_t*', hook_bytes + 1)[0] = detour_addr - hook_addr - 5
- new_hook.call = ffi.cast(cast, hook_addr)
- new_hook.status = false
- local function set_status(bool)
- new_hook.status = bool
- ffi.C.VirtualProtect(void_addr, size, 0x40, old_prot)
- ffi.copy(void_addr, bool and hook_bytes or org_bytes, size)
- ffi.C.VirtualProtect(void_addr, size, old_prot[0], old_prot)
- end
- new_hook.stop = function() set_status(false) end
- new_hook.start = function() set_status(true) end
- new_hook.start()
- table.insert(hook.hooks, new_hook)
- return setmetatable(new_hook, {
- __call = function(self, ...)
- self.stop()
- local res = self.call(...)
- self.start()
- return res
- end
- })
- end
- --HOOKS
- function imgui.TextColoredRGB(text)
- local style = imgui.GetStyle()
- local colors = style.Colors
- local ImVec4 = imgui.ImVec4
- local explode_argb = function(argb)
- local a = bit.band(bit.rshift(argb, 24), 0xFF)
- local r = bit.band(bit.rshift(argb, 16), 0xFF)
- local g = bit.band(bit.rshift(argb, 8), 0xFF)
- local b = bit.band(argb, 0xFF)
- return a, r, g, b
- end
- local getcolor = function(color)
- if color:sub(1, 6):upper() == 'SSSSSS' then
- local r, g, b = colors[1].x, colors[1].y, colors[1].z
- local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
- return ImVec4(r, g, b, a / 255)
- end
- local color = type(color) == 'string' and tonumber(color, 16) or color
- if type(color) ~= 'number' then return end
- local r, g, b, a = explode_argb(color)
- return imgui.ImColor(r, g, b, a):GetVec4()
- end
- local render_text = function(text_)
- for w in text_:gmatch('[^\r\n]+') do
- local text, colors_, m = {}, {}, 1
- w = w:gsub('{(......)}', '{%1FF}')
- while w:find('{........}') do
- local n, k = w:find('{........}')
- local color = getcolor(w:sub(n + 1, k - 1))
- if color then
- text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
- colors_[#colors_ + 1] = color
- m = n
- end
- w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
- end
- if text[0] then
- for i = 0, #text do
- imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
- imgui.SameLine(nil, 0)
- end
- imgui.NewLine()
- else imgui.Text(u8(w)) end
- end
- end
- render_text(text)
- 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()
- function hasRename()
- local SCRIPT_NAME = "AdminToolsRodina"
- local SCRIPT_EXTENSION = ".luac"
- if thisScript().name ~= string.format("%s%s", tostring(SCRIPT_NAME), tostring(SCRIPT_EXTENSION)) then
- return true
- else
- return false
- end
- end
- function main() -- Главная функция
- if not isSampLoaded() or not isSampfuncsLoaded() then return end
- while not isSampAvailable() do wait(100) end
- if hasRename() then
- SCM("Верните обратно название скрипта - RodinaTools.luac")
- print("[LOG] Изменено название скрипта. Скрипт завершил работу.")
- thisScript():unload()
- end
- wait(500)
- local _, myID = sampGetPlayerIdByCharHandle(PLAYER_PED)
- local MyNickname = sampGetPlayerNickname(myID)
- local linkAccess = "https://raw.githubusercontent.com/Glade412/RodinaToolsADM/master/AccesADM.txt"
- local fpathAccess = os.getenv('TEMP') .. '\\AAdm.txt'
- downloadUrlToFile(linkAccess, fpathAccess, function(id3, status, p13, p23)
- if status == dlstatus.STATUS_ENDDOWNLOADDATA then
- local fileReadAccess = io.open(fpathAccess, 'r')
- if fileReadAccess then
- local CheckAccess = fileReadAccess:read('*a')
- if CheckAccess:find("(%d+)%:"..MyNickname) then
- ipServ, PortServ = sampGetCurrentServerAddress()
- if tostring(ipServ) == tostring("185.169.134.163") and tostring(PortServ) == "7777" then -- CO
- titleOkrug = "CO"
- nameOkrug = "Центральный Округ"
- serverIPandPort_auth = true
- end
- if tostring(ipServ) == tostring("185.169.134.60") and tostring(PortServ) == "8904" then -- YUO
- titleOkrug = "YUO"
- nameOkrug = "Южный Округ"
- serverIPandPort_auth = true
- end
- if tostring(ipServ) == tostring("185.169.134.62") and tostring(PortServ) == "8904" then -- SO
- titleOkrug = "SO"
- nameOkrug = "Северный Округ"
- serverIPandPort_auth = true
- end
- if tostring(ipServ) == tostring("185.169.134.108") and tostring(PortServ) == "7777" then -- VO
- titleOkrug = "VO"
- nameOkrug = "Восточный Округ"
- serverIPandPort_auth = true
- end
- if tostring(ipServ) == tostring("149.202.199.88") and tostring(PortServ) == "8904" then -- Test
- titleOkrug = "Test"
- nameOkrug = "Test Server Rodina"
- serverIPandPort_auth = true
- end
- if not serverIPandPort_auth then
- print("[LOG] На данном сервере скрипт работать не будет! Работает только на серверах Родины РП.")
- print("[LOG] Был выполнен заход на - "..ipServ..":"..PortServ)
- thisScript():unload()
- end
- print("[LOG] Авторизация на сервер прошла успешно - "..nameOkrug)
- fileReadAccess:close()
- os.remove(fpathAccess)
- authorization = true
- else
- SCM("You do not have access..")
- print("[LOG] Пользователь "..MyNickname.." не имеет доступа к скрипту. Обратитесь к автору скрипта.")
- fileReadAccess:close()
- os.remove(fpathAccess)
- thisScript():unload()
- end
- end
- end
- end)
- imgui.Process = false
- while true do
- wait(0)
- if authorization then
- StartWork()
- authorization = false
- end
- if not SCRIPT_READY and update_ok and startwork_ok and tonumber(my_lvl_adm) then
- SCRIPT_READY = true
- adminschecker()
- end
- if SCRIPT_READY then
- if main_window_state.v or recon_status then
- if recon_status and data.ReconHelper.turn then
- imgui.Process = true
- end
- if main_window_state.v then
- imgui.Process = true
- end
- else
- imgui.Process = false
- end
- if admchecker_changemoverender then
- mouseX, mouseY = getCursorPos()
- renderFontDrawText(admchecker_font, '{146300}Admins online {FFFFFF}[?]:', mouseX, mouseY, -1)
- if isKeyDown(VK_LBUTTON) then
- admchecker_changemoverender = false
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- data.AdmChecker.coordX = mouseX
- data.AdmChecker.coordY = mouseY
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- sampToggleCursor(false)
- main_window_state.v = true
- end
- else
- if data.AdmChecker.turn then
- achPosition = data.AdmChecker.coordY + 23
- renderFontDrawText(admchecker_font, '{146300}Admins online {FFFFFF}['..#admchecker_adminList..']:', data.AdmChecker.coordX, data.AdmChecker.coordY, -1)
- for i = 1, #admchecker_adminList do
- renderFontDrawText(admchecker_font, admchecker_adminList[i][1], data.AdmChecker.coordX, achPosition, -1)
- achPosition = achPosition + 17
- end
- end
- end
- if os.clock() >= admchecker_SortingTime and admchecker_SortingList then
- table.sort(scores, function(lhs, rhs)
- return lhs[2] > rhs[2]
- end)
- admchecker_adminList = scores
- admchecker_SortingList = false
- end
- end
- if sampGetPlayerScore(getMyID()) > 0 and check_lvl_admbool then
- sampSendChat("/admins")
- check_my_lvlAdm = true
- check_lvl_admbool = false
- end
- end
- end
- function StartWork()
- if not doesDirectoryExist("moonloader\\config") then
- print("[LOG] Отсутствует папка config. Она была автоматически создана.")
- createDirectory("moonloader\\config")
- end
- if not doesDirectoryExist("moonloader\\config\\RodinaTools") then
- print("[LOG] Отсутствует папка RodinaTools. Она была автоматически создана.")
- createDirectory("moonloader\\config\\RodinaTools")
- end
- if not doesFileExist("moonloader\\config\\RodinaTools\\"..nameINI) then
- print("[LOG] Отсутствует файл AdmChecker.ini. Он был автоматически создан.")
- local data =
- {
- AdmChecker =
- {
- turn = true,
- FontName = "Verdana",
- FontSize = 9,
- FontFlag = 5,
- coordX = 40,
- coordY = 400,
- fullInfo = false,
- reportInfo = false,
- reportInfoOnlyForMe = false,
- Move1lvlAdm = true,
- Move2lvlAdm = true,
- Move3lvlAdm = true,
- Move4lvlAdm = true,
- Move5lvlAdm = true,
- Move6lvlAdm = true
- },
- ReconHelper =
- {
- turn = false
- }
- };
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- admchecker_turn = imgui.ImBool(data.AdmChecker.turn)
- recon_turn = imgui.ImBool(data.ReconHelper.turn)
- fullInfo = imgui.ImBool(data.AdmChecker.fullInfo)
- admchecker_input_changeFontName = imgui.ImBuffer(256)
- admchecker_input_changeFontSize = imgui.ImBuffer(256)
- admchecker_input_changeFontFlag = imgui.ImBuffer(256)
- reportInfo = imgui.ImBool(data.AdmChecker.reportInfo)
- reportInfoOnlyForMe = imgui.ImBool(data.AdmChecker.reportInfoOnlyForMe)
- Move1lvlAdm = imgui.ImBool(data.AdmChecker.Move1lvlAdm)
- Move2lvlAdm = imgui.ImBool(data.AdmChecker.Move2lvlAdm)
- Move3lvlAdm = imgui.ImBool(data.AdmChecker.Move3lvlAdm)
- Move4lvlAdm = imgui.ImBool(data.AdmChecker.Move4lvlAdm)
- Move5lvlAdm = imgui.ImBool(data.AdmChecker.Move5lvlAdm)
- Move6lvlAdm = imgui.ImBool(data.AdmChecker.Move6lvlAdm)
- if data.AdmChecker.turn then
- admchecker_statustextmenu = "Включено"
- else
- admchecker_statustextmenu = "Выключено"
- end
- if data.ReconHelper.turn then
- recon_statustextmenu = "Включено"
- else
- recon_statustextmenu = "Выключено"
- end
- admchecker_font = renderCreateFont(data.AdmChecker.FontName, data.AdmChecker.FontSize, data.AdmChecker.FontFlag);
- if not doesFileExist("moonloader\\config\\RodinaTools\\"..titleOkrug.."SAdm.txt") then
- print("[LOG] Отсутствует файл "..titleOkrug.."SAdm.txt. Он был автоматически создан.")
- SCM("Скачиваю файл с Администраторами 5-6 лвла - "..nameOkrug)
- local link = "https://raw.githubusercontent.com/Glade412/RodinaToolsADM/master/SAdminList/"..titleOkrug.."SAdm.txt"
- local fpath = getWorkingDirectory().."/config/RodinaTools/"..titleOkrug.."SAdm.txt"
- downloadUrlToFile(link, fpath, function(id3, status1, p13, p23)
- if status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
- print("[LOG] Файл "..titleOkrug.."SAdm.txt был успешно скачан.")
- end
- end)
- end
- recon_timeCheckComplete = os.time()
- dialogHook = hook.new('void(__thiscall *)(void *this, uint16_t wID, uint8_t iStyle, char *szCaption, char *szText, char *szButton1, char *szButton2, bool bSend)', dialogHook, getModuleHandle('samp.dll') + 0x6B9C0)
- sampRegisterChatCommand("amenu", cmd_mainimgui)
- sampRegisterChatCommand("admins", cmd_admins)
- SCM('AdminTools Loaded...')
- print("[LOG] Скрипт успешно начал работу.")
- check_lvl_admbool = true
- startwork_ok = true
- update()
- end
- function dialogHook(this, id, style, caption, text, button1, button2, send)
- if ffi.string(caption):find("Статистика игрока") and recon_checkstats then
- recon_textSTAT = ffi.string(text)
- if recon_textSTAT:match("{ffffff}Организация:(.*){DC143C}Нет(.*){ffffff}Должность:(.*){DC143C}Нет(.*){ffffff}Супруг") then
- recon_org = "Не имеется"
- recon_rangCheck = false
- else
- recon_org, recon_rangTitle, recon_rangNumber = recon_textSTAT:match("{ffffff}Организация:.*{DC143C}(.*) {ffffff}Должность:.*{DC143C}(.*)%s%((.*)%).*{ffffff}Супруг")
- recon_rangCheck = true
- end
- recon_checkstats = false
- else
- dialogHook.stop()
- dialogHook.call(this, id, style, caption, text, button1, button2, send)
- dialogHook.start()
- end
- end
- -------------------------------CMDS
- function cmd_mainimgui()
- main_window_state.v = not main_window_state.v
- imgui.Process = main_window_state.v
- end
- function cmd_admins()
- sampSendChat("/admins")
- sampAddChatMessage("{33CC00}Администрация онлайн:", -1)
- for i = 1, #admchecker_adminList_forCMD do
- sampAddChatMessage(admchecker_adminList_forCMD[i], -1714618369)
- end
- end
- function cmd_checklvl()
- sampSendChat("/admins")
- check_my_lvlAdm = true
- end
- -----------------------------------
- function adminschecker()
- lua_thread.create(function ()
- while data.AdmChecker.turn do
- wait(0)
- if sampGetGamestate() == 3 then
- if not isGamePaused() then
- sampSendChat("/admins")
- end
- wait(tonumber(admchecker_timerForCheck))
- end
- end
- end)
- end
- -------------------------------EVENTS
- function sampev.onServerMessage(color, text)
- if color == -1 and text:match("Администрация онлайн:") then
- if SCRIPT_READY and data.AdmChecker.turn then
- scores = {}
- if not doesFileExist("moonloader\\config\\RodinaTools\\"..titleOkrug.."SAdm.txt") then
- if not admchecker_helpmark then
- admchecker_helpmark = true
- SCM("У вас отсутствует файл с Администрацией 5-6 лвла, для установки - /loadsadm")
- end
- else
- for line in io.lines(getWorkingDirectory().."/config/RodinaTools/"..titleOkrug.."SAdm.txt") do
- local AdminNick, lvl = line:match("^(.*),(%d+)")
- admchecker_lvl = tonumber(lvl)
- if sampGetPlayerIdByNickname(AdminNick) then
- SadmID = sampGetPlayerIdByNickname(AdminNick)
- admchecker_Sid_text = "["..SadmID.."]"
- if tonumber(admchecker_lvl) == 6 then
- admchecker_Snick_text = "{c70219}"..AdminNick.."{FFFFFF}"
- if data.AdmChecker.Move6lvlAdm then
- admchecker_SAdmpart = admchecker_Snick_text..""..admchecker_Sid_text
- table.insert(scores, {admchecker_SAdmpart, admchecker_lvl})
- end
- elseif tonumber(admchecker_lvl) == 5 then
- admchecker_Snick_text = "{05960a}"..AdminNick.."{FFFFFF}"
- if data.AdmChecker.Move5lvlAdm then
- admchecker_SAdmpart = admchecker_Snick_text..""..admchecker_Sid_text
- table.insert(scores, {admchecker_SAdmpart, admchecker_lvl})
- end
- end
- end
- end
- end
- admchecker_SortingTime = os.clock() + 0.5
- admchecker_SortingList = true
- end
- admchecker_adminList_forCMD = {}
- return false
- end
- if color == -1714618369 and text:match("(%d+)%.%s%{fefe22%}(.*)%s%[ID%:%s(%d+)%]%s%-%s(.*)%[(%d+)%sур%]%s(.*)%-(.*)%[AFK%:%s(%d+)%]%{FFFFFF%}%s%-%sРепутация%:%s(%d+)") then
- local posInAdm, nick, id, titleAdm, lvlAdm, part1, part2, afk, report = text:match("(%d+)%.%s%{fefe22%}(.*)%s%[ID%:%s(%d+)%]%s%-%s(.*)%[(%d+)%sур%]%s(.*)%-(.*)%[AFK%:%s(%d+)%]%{FFFFFF%}%s%-%sРепутация%:%s(%d+)")
- table.insert(admchecker_adminList_forCMD, posInAdm..". {fefe22}"..nick.." [ID: "..id.."] - "..titleAdm.."["..lvlAdm.." ур]"..part1.."-"..part2.."[AFK: "..afk.."]{FFFFFF} - Репутация: "..report)
- if check_my_lvlAdm then
- if nick == sampGetPlayerNickname(getMyID()) then
- my_lvl_adm = lvlAdm
- check_my_lvlAdm = false
- end
- end
- if SCRIPT_READY and data.AdmChecker.turn then
- if part1:match("%{FFFFFF%} %- %{DC2020%}%/re (%d+)") then
- admchecker_recon_id = part1:match("%{FFFFFF%} %- %{DC2020%}%/re (%d+)")
- if tonumber(admchecker_recon_id) == getMyID() then
- admchecker_recon_text = " - {029c37}Следит за тобой{FFFFFF}"
- else
- admchecker_recon_text = " - {8c0023}/re "..admchecker_recon_id.."{FFFFFF}"
- end
- else
- admchecker_recon_text = ""
- end
- if tonumber(afk) > 0 then
- admchecker_afk_text = " - {929693}[AFK: "..afk.."]{FFFFFF}"
- else
- admchecker_afk_text = ""
- end
- local admchecker_id_text = "["..id.."]"
- local admchecker_report_text = " {FFFFFF}- Реп: "..report.."{FFFFFF}"
- local score = tonumber(lvlAdm)
- if data.AdmChecker.fullInfo and data.AdmChecker.reportInfo then
- if data.AdmChecker.reportInfoOnlyForMe then
- if nick == sampGetPlayerNickname(getMyID()) then
- admchecker_other_part = admchecker_id_text..""..admchecker_afk_text..""..admchecker_recon_text..""..admchecker_report_text
- else
- admchecker_other_part = admchecker_id_text..""..admchecker_afk_text..""..admchecker_recon_text
- end
- else
- admchecker_other_part = admchecker_id_text..""..admchecker_afk_text..""..admchecker_recon_text..""..admchecker_report_text
- end
- elseif data.AdmChecker.fullInfo and not data.AdmChecker.reportInfo then
- admchecker_other_part = admchecker_id_text..""..admchecker_afk_text..""..admchecker_recon_text
- elseif not data.AdmChecker.fullInfo and data.AdmChecker.reportInfo then
- if data.AdmChecker.reportInfoOnlyForMe == 1 then
- if nick == sampGetPlayerNickname(getMyID()) then
- admchecker_other_part = admchecker_id_text..""..admchecker_report_text
- else
- admchecker_other_part = admchecker_id_text
- end
- else
- admchecker_other_part = admchecker_id_text..""..admchecker_report_text
- end
- elseif not data.AdmChecker.fullInfo and not data.AdmChecker.reportInfo then
- admchecker_other_part = admchecker_id_text
- end
- if tonumber(lvlAdm) == 4 then
- admchecker_nick_text = "{030FC4}"..nick.."{FFFFFF}"
- if data.AdmChecker.Move4lvlAdm then
- admchecker_part = admchecker_nick_text..""..admchecker_other_part
- table.insert(scores, {admchecker_part, score})
- end
- elseif tonumber(lvlAdm) == 3 then
- admchecker_nick_text = "{EEFF00}"..nick.."{FFFFFF}"
- if data.AdmChecker.Move3lvlAdm then
- admchecker_part = admchecker_nick_text..""..admchecker_other_part
- table.insert(scores, {admchecker_part, score})
- end
- elseif tonumber(lvlAdm) == 2 then
- admchecker_nick_text = "{2b61ce}"..nick.."{FFFFFF}"
- if data.AdmChecker.Move2lvlAdm then
- admchecker_part = admchecker_nick_text..""..admchecker_other_part
- table.insert(scores, {admchecker_part, score})
- end
- elseif tonumber(lvlAdm) == 1 then
- admchecker_nick_text = "{32b0c5}"..nick.."{FFFFFF}"
- if data.AdmChecker.Move1lvlAdm then
- admchecker_part = admchecker_nick_text..""..admchecker_other_part
- table.insert(scores, {admchecker_part, score})
- end
- end
- end
- return false
- end
- if recon_getipCheck and color == 1790050218 and text:match("Nik %[(.*)%]") then
- local NickPL, RIP, IP = text:match("Nik %[(.*)%] R%-IP%s%[(.*)]%s%sIP%s%[(.*)%]")
- if recon_ID then
- local recon_getipNick = sampGetPlayerNickname(recon_ID)
- cl = RIP .. " " .. IP
- print(NickPL .. " " .. cl)
- ips = {}
- for word in string.gmatch(cl, "(%d+%p%d+%p%d+%p%d+)") do
- table.insert(ips, { query = word })
- end
- if #ips > 0 then
- data_json = cjson.encode(ips)
- asyncHttpRequest("POST", "http://ip-api.com/batch?fields=25305&lang=ru", { data = data_json },
- function(response)
- local rdata = cjson.decode(u8:decode(response.text))
- local text = ""
- if rdata[1]["status"] == "success" and rdata[2]["status"] == "success" then
- local distances =
- distance_cord(
- rdata[1]["lat"],
- rdata[1]["lon"],
- rdata[2]["lat"],
- rdata[2]["lon"]
- )
- sampAddChatMessage("[IPChecker] {FFFFFF}Ник - {0f961a}"..recon_getipNick.." {FFFFFF}| RegIP - {0f961a}"..RIP.." {FFFFFF}| LastIP - {0f961a}"..IP, 0xdeb226)
- sampAddChatMessage("[REG] {FFFFFF}Страна - {0f961a}"..rdata[1]["country"].." {FFFFFF}| Город - {0f961a}"..rdata[1]["city"].." {FFFFFF}| Провайдер - {0f961a}"..rdata[1]["isp"], 0xdeb226)
- sampAddChatMessage("[LAST] {FFFFFF}Страна - {0f961a}"..rdata[2]["country"].." {FFFFFF}| Город - {0f961a}"..rdata[2]["city"].." {FFFFFF}| Провайдер - {0f961a}"..rdata[2]["isp"], 0xdeb226)
- sampAddChatMessage("[DIST] {FFFFFF}Расстояние между городами - {0f961a}"..math.ceil(distances-0.5).." {FFFFFF}км", 0xdeb226)
- end
- end,
- function(err)
- sampAddChatMessage("Информация о IP Произошла ошибка:", -1)
- sampAddChatMessage(err, -1)
- end)
- else
- SCM("ID за кем вы следите не найден.")
- end
- end
- recon_getipCheck = false
- return false
- end
- if recon_PgetipCheck and color == 1790050218 and text:match("Nik %[(.*)%]") then
- local NickPL, RIP, IP = text:match("Nik %[(.*)%] R%-IP%s%[(.*)]%s%sIP%s%[(.*)%]")
- sampSendChat("/pgetip "..IP)
- recon_PgetipCheck = false
- end
- if recon_cmdWeap and color == 1687547391 and text:match("Вы отобрали оружие у игрока%s(.*)%[(%d+)%]") then
- SCM("Оружие отобрано у игрока "..recon_nickname.." ["..recon_ID.."]")
- recon_cmdWeap = false
- return false
- end
- end
- function sampev.onTextDrawHide(textDrawId)
- if textDrawId == recon_TD_main then
- recon_status = false
- end
- end
- function sampev.onShowTextDraw(id, data)
- if data.boxColor == 1428035613 then
- recon_TD_DEL = id
- end
- end
- function sampev.onTextDrawSetString(id, text)
- if text:match("ID%:%s(%d+)___%((.*)%)%~n%~HP%:%s(.*)%~n%~(.*)") then
- recon_TD_main = id
- recon_TD_dop = recon_TD_main + 1
- recon_TD_nickname = recon_TD_main - 1
- end
- --print(id.." ".. text)
- if id == recon_TD_main then
- RPtext1 = text
- if RPtext1:match("(.*)Arm%:(.*)") then
- recon_ID, versClient, recon_HP, recon_ARM, recon_vHP, color_statusENG, recon_statusENG, recon_vSpeed, recon_ping, recon_fuel, recon_gun, recon_ammo = RPtext1:match("ID%:%s(%d+)___%((.*)%)%~n%~HP%:%s(.*)%~n%~Arm%:%s(.*)%~n%~vHP%:%s(.*)__%(%~(.*)%~eng%s(.*)%~w%~%)%~n%~vSpeed%:%s(%d+)km%/h%~n%~Ping%:%s(%d+)%~n%~Fuel%:%s(.*)%slitres%~n%~Gun%:%sid%s(%d+)__ammo%:%s(.*)")
- if recon_ID and recon_HP and recon_ARM and recon_vHP and recon_statusENG and recon_vSpeed and recon_ping and recon_fuel and recon_gun and recon_ammo then
- recon_nickname = sampGetPlayerNickname(recon_ID)
- -- print(recon_nickname.." | "..recon_ID.." | "..recon_HP.." | "..recon_ARM.." | "..recon_vHP.." | "..recon_statusENG.." | "..recon_vSpeed.." | "..recon_ping.." | "..recon_fuel.." | "..recon_gun.." | "..recon_ammo)
- end
- else
- recon_ID, versClient, recon_HP, recon_ARM, recon_ping, recon_gun, recon_ammo = RPtext1:match("ID%:%s(%d+)___%((.*)%)%~n%~HP%:%s(.*)%~n%~Armour%:%s(.*)%~n%~Ping%:%s(%d+)%~n%~Gun%:%sid%s(%d+)__ammo%:%s(.*)")
- if recon_ID and recon_HP and recon_ARM and recon_ping and recon_gun and recon_ammo then
- recon_nickname = sampGetPlayerNickname(recon_ID)
- -- print(recon_nickname.." | "..recon_ID.." | "..recon_HP.." | "..recon_ARM.." | "..recon_ping.." | "..recon_gun.." | "..recon_ammo)
- end
- end
- end
- if id == recon_TD_dop then
- RPtext2 = text
- recon_lvl, recon_money, recon_bankmoney, recon_deposit, recon_warns = RPtext2:match("LVL%:%s(%d+)%~n%~Money%:%s(%d+)_r%~n%~Bank%:%s(%d+)_r%~n%~Deposit%:%s(%d+)_r%~n%~Warn%:%s(%d+)%~n%~")
- if recon_lvl and recon_money and recon_bankmoney and recon_deposit and recon_warns then
- -- print(recon_lvl.." | "..recon_money.." | "..recon_bankmoney.." | "..recon_deposit.." | "..recon_warns)
- end
- end
- end
- function sampev.onSpectatePlayer(playerId, camType)
- recon_ID = playerId
- print(playerId)
- recon_onFoot = true
- recon_status = true
- end
- function sampev.onSpectateVehicle(vehicleId, camType)
- print(vehicleId)
- recon_vehID = vehicleId
- recon_onCar = true
- recon_onCar_stats = true
- recon_status = true
- end
- function sampev.onSendCommand(command)
- if command:match("/re%s(%d+)") or command:match("/re_next") then
- checkStatsPlayerOTHER()
- end
- end
- -------------------------------------------------------------------
- function imgui.OnDrawFrame()
- if main_window_state.v then
- imgui.SetNextWindowSize(imgui.ImVec2(800, 350), imgui.Cond.FirstUseEver)
- local sW, sH = getScreenResolution()
- if not recon_status then
- imgui.ShowCursor = true
- end
- imgui.SetNextWindowPos(imgui.ImVec2(sW / 2, sH / 2), imgui.Cond.ImGuiCond_Always, imgui.ImVec2(0.5, 0.5))
- imgui.Begin("RodinaTools",main_window_state, imgui.WindowFlags.NoResize)
- imgui.BeginChild('left pane', imgui.ImVec2(150, 0), false)
- if imgui.Button(u8"Админ Чекер", imgui.ImVec2(145, 20)) then
- uu()
- tab[1] = true
- end
- if imgui.Button(u8"Рекон Хелпер", imgui.ImVec2(145, 20)) then
- uu()
- tab[2] = true
- end
- imgui.EndChild()
- imgui.SameLine(175)
- if tab[1] == true then
- imgui.BeginGroup()
- imgui.Text(u8"Админ Чекер")
- imgui.Separator()
- if imgui.ToggleButton(u8("##554479548"), admchecker_turn) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.turn then
- admchecker_statustextmenu = "Выключено"
- data.AdmChecker.turn = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- admchecker_statustextmenu = "Включено"
- data.AdmChecker.turn = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- imgui.SameLine(30)
- imgui.Text(u8(admchecker_statustextmenu))
- imgui.Separator()
- imgui.BeginGroup()
- imgui.PushItemWidth(200)
- imgui.InputText("##changeFontName", admchecker_input_changeFontName)
- imgui.PopItemWidth()
- imgui.SameLine(400)
- if not imgui.IsItemActive() and admchecker_input_changeFontName.v:len() == 0 then
- imgui.SameLine(4)
- imgui.TextColoredRGB("{807f7d}Шрифт: "..data.AdmChecker.FontName)
- end
- imgui.SameLine(210)
- if imgui.Button(u8"Сохранить##1", imgui.ImVec2(70, 20)) then
- if admchecker_input_changeFontName.v == "" then
- SCM("Нельзя оставлять пустую строку")
- else
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- data.AdmChecker.FontName = admchecker_input_changeFontName.v
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- admchecker_font = renderCreateFont(data.AdmChecker.FontName, data.AdmChecker.FontSize, data.AdmChecker.FontFlag);
- admchecker_input_changeFontName.v = ""
- end
- end
- imgui.PushItemWidth(200)
- imgui.InputText("##changeFontSize", admchecker_input_changeFontSize)
- imgui.PopItemWidth()
- if not imgui.IsItemActive() and admchecker_input_changeFontSize.v:len() == 0 then
- imgui.SameLine(4)
- imgui.TextColoredRGB("{807f7d}Размер шрифта: "..data.AdmChecker.FontSize)
- end
- imgui.SameLine(210)
- if imgui.Button(u8"Сохранить##2", imgui.ImVec2(70, 20)) then
- if admchecker_input_changeFontSize.v == "" then
- SCM("Нельзя оставлять пустую строку")
- else
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- data.AdmChecker.FontSize = admchecker_input_changeFontSize.v
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- admchecker_font = renderCreateFont(data.AdmChecker.FontName, data.AdmChecker.FontSize, data.AdmChecker.FontFlag);
- admchecker_input_changeFontSize.v = ""
- end
- end
- imgui.PushItemWidth(200)
- imgui.InputText("##changeFontFlag", admchecker_input_changeFontFlag)
- imgui.PopItemWidth()
- if not imgui.IsItemActive() and admchecker_input_changeFontFlag.v:len() == 0 then
- imgui.SameLine(4)
- imgui.TextColoredRGB("{807f7d}Флаг шрифта: "..data.AdmChecker.FontFlag)
- end
- imgui.SameLine(210)
- if imgui.Button(u8"Сохранить##3", imgui.ImVec2(70, 20)) then
- if admchecker_input_changeFontFlag.v == "" then
- SCM("Нельзя оставлять пустую строку")
- else
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- data.AdmChecker.FontFlag = admchecker_input_changeFontFlag.v
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- admchecker_font = renderCreateFont(data.AdmChecker.FontName, data.AdmChecker.FontSize, data.AdmChecker.FontFlag);
- admchecker_input_changeFontFlag.v = ""
- end
- end
- if imgui.Checkbox(u8'Отображать статус рекона', fullInfo) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.fullInfo then
- data.AdmChecker.fullInfo = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.fullInfo = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- if imgui.Checkbox(u8'Отображать кол-во репорт', reportInfo) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.reportInfo then
- data.AdmChecker.reportInfo = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.reportInfo = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- if data.AdmChecker.reportInfo then
- if imgui.Checkbox(u8'Отображать только свой репорт', reportInfoOnlyForMe) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.reportInfoOnlyForMe then
- data.AdmChecker.reportInfoOnlyForMe = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.reportInfoOnlyForMe = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- end
- imgui.Text("")
- if imgui.Button(u8"Сменить позицию рендера##13", imgui.ImVec2(200, 20)) then
- sampToggleCursor(true)
- admchecker_changemoverender = true
- main_window_state.v = false
- end
- imgui.Text(u8("Координаты: X"..data.AdmChecker.coordX.." Y"..data.AdmChecker.coordY))
- imgui.Text("")
- imgui.Text("")
- if imgui.Button(u8"Перекачать список Руководящей Администрации (5+)##1231234", imgui.ImVec2(323, 20)) then
- local link = "https://raw.githubusercontent.com/Glade412/RodinaToolsADM/master/SAdminList/"..titleOkrug.."SAdm.txt"
- local fpath = getWorkingDirectory().."/config/RodinaTools/"..titleOkrug.."SAdm.txt"
- os.remove(fpath)
- downloadUrlToFile(link, fpath, function(id3, status1, p13, p23)
- if status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
- SCM("Файл с Админами 5-6 лвла скачан")
- print("[LOG] Файл с администрацией успешно скачан.")
- end
- end)
- end
- imgui.EndGroup()
- imgui.SameLine(350)
- imgui.BeginChild('Dop panel#12354', imgui.ImVec2(173, 155), true)
- if imgui.Checkbox(u8'Отображение 1 лвл`а', Move1lvlAdm) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.Move1lvlAdm then
- data.AdmChecker.Move1lvlAdm = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.Move1lvlAdm = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- if imgui.Checkbox(u8'Отображение 2 лвл`а', Move2lvlAdm) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.Move2lvlAdm then
- data.AdmChecker.Move2lvlAdm = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.Move2lvlAdm = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- if imgui.Checkbox(u8'Отображение 3 лвл`а', Move3lvlAdm) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.Move3lvlAdm then
- data.AdmChecker.Move3lvlAdm = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.Move3lvlAdm = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- if imgui.Checkbox(u8'Отображение 4 лвл`а', Move4lvlAdm) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.Move4lvlAdm then
- data.AdmChecker.Move4lvlAdm = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.Move4lvlAdm = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- if imgui.Checkbox(u8'Отображение 5 лвл`а', Move5lvlAdm) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.Move5lvlAdm then
- data.AdmChecker.Move5lvlAdm = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.Move5lvlAdm = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- if imgui.Checkbox(u8'Отображение 6 лвл`а', Move6lvlAdm) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.AdmChecker.Move6lvlAdm then
- data.AdmChecker.Move6lvlAdm = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- else
- data.AdmChecker.Move6lvlAdm = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- imgui.EndChild()
- imgui.EndGroup()
- end
- if tab[2] == true then
- imgui.BeginGroup()
- imgui.Text(u8"Рекон Хелпер")
- imgui.Separator()
- if imgui.ToggleButton(u8("##554479548"), recon_turn) then
- data = LIP.load('moonloader\\config\\RodinaTools\\'..nameINI);
- if data.ReconHelper.turn then
- recon_statustextmenu = "Выключено"
- data.ReconHelper.turn = false
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- sampSendChat("/reoff")
- else
- recon_statustextmenu = "Включено"
- data.ReconHelper.turn = true
- LIP.save('moonloader\\config\\RodinaTools\\'..nameINI, data);
- end
- end
- imgui.SameLine(30)
- imgui.Text(u8(recon_statustextmenu))
- imgui.Separator()
- imgui.EndGroup()
- end
- imgui.End()
- end
- if recon_status and data.ReconHelper.turn then
- delrec()
- RPx, RPy = getScreenResolution()
- -- 218 - Без кара с рангом
- -- 198 - без кара и без ранга
- -- 400 - с каром и без ранга
- -- 420 - с каром и рангом
- resultCheckPL, hendlPLcheck = sampGetCharHandleBySampPlayerId(recon_ID)
- if resultCheckPL and isCharInAnyCar(hendlPLcheck) then
- if recon_rangCheck then
- Ycord = 307
- else
- Ycord = 287
- end
- else
- if recon_rangCheck then
- Ycord = 218
- else
- Ycord = 198
- end
- end
- imgui.SetNextWindowPos(imgui.ImVec2(RPx - 320, RPy - Ycord), imgui.ImVec2(0.5, 0.5))
- imgui.SetNextWindowSize(imgui.ImVec2(320, Ycord))
- imgui.Begin(u8("##reCON3"), _, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoSavedSettings + imgui.WindowFlags.NoTitleBar)
- if recon_nickname and recon_ID and recon_HP and recon_ARM and recon_lvl and recon_ping and recon_gun and recon_ammo and recon_money and recon_bankmoney and recon_deposit and recon_warns then
- imgui.SameLine(90)
- imgui.Text(u8(recon_nickname.." ["..recon_ID.."]"))
- imgui.Columns(4)
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Уровень")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_lvl)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("АФК")); imgui.NextColumn()
- if sampIsPlayerPaused(recon_ID) then
- recon_AFK = "Yes"
- else
- recon_AFK = "No"
- end
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_AFK)); imgui.NextColumn()
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Здоровье")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_HP)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Броня")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_ARM)); imgui.NextColumn()
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Пинг")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_ping)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Скин")); imgui.NextColumn()
- resultskinid, skinID = sampGetPlayerSkin(recon_ID)
- if not resultskinid then
- skinID = "-"
- end
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(skinID))
- imgui.Columns(2)
- imgui.Separator()
- imgui.SetColumnWidth(-1, 85); imgui.Text(u8("Оружие/ПТ")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 200); imgui.Text(u8(recon_gun.."/"..recon_ammo)); imgui.NextColumn()
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Фракция")); imgui.NextColumn()
- if not recon_org then
- recon_org = "Не известно"
- end
- imgui.SetColumnWidth(-1, 270); imgui.Text(u8(recon_org)); imgui.NextColumn()
- imgui.Columns(1)
- if recon_rangCheck then
- imgui.Columns(2)
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Ранг")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 270); imgui.Text(u8(recon_rangTitle.." ("..recon_rangNumber..")")); imgui.NextColumn()
- imgui.Columns(1)
- end
- resultFootSpeed, pedSpeed = sampGetCharHandleBySampPlayerId(recon_ID)
- if resultFootSpeed and not isCharInAnyCar(pedSpeed) then
- footSpeed = tostring(math.floor(getCharSpeed(pedSpeed)))
- else
- footSpeed = "-"
- end
- imgui.Columns(4)
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Speed Foot")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8(footSpeed)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8("Warns")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8(recon_warns)); imgui.NextColumn()
- imgui.Columns(3)
- imgui.Separator()
- imgui.SetColumnWidth(-1, 106); imgui.CenterColumnText(u8("На руках:")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 106); imgui.CenterColumnText(u8("Банк:")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 106); imgui.CenterColumnText(u8("Депозит:")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 106); imgui.CenterColumnText(u8(recon_money)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 106); imgui.CenterColumnText(u8(recon_bankmoney)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 106); imgui.CenterColumnText(u8(recon_deposit)); imgui.NextColumn()
- imgui.Columns(1)
- imgui.Separator()
- else
- recon_nickname = "-"
- recon_ID = "-"
- recon_HP = "-"
- recon_ARM = "-"
- recon_lvl = "-"
- recon_gun = 0
- recon_ammo = "-"
- recon_money = "-"
- recon_bankmoney = "-"
- recon_ping = "-"
- recon_deposit = "-"
- recon_warns = "-"
- end
- resultcar, hendlPL = sampGetCharHandleBySampPlayerId(recon_ID)
- if resultcar and isCharInAnyCar(hendlPL) then
- footSpeed = "InCar"
- carHandle = storeCarCharIsInNoSave(hendlPL)
- carType = getCarModel(carHandle)
- resultIDCAR, idCAR = sampGetVehicleIdByCarHandle(carHandle)
- if not resultIDCAR then
- idCAR = "-"
- end
- VehName = getCarName(carType)
- if VehName and recon_statusENG and recon_vSpeed and recon_vHP and recon_fuel then
- imgui.NewLine()
- imgui.SameLine(115)
- imgui.Text(u8(VehName))
- imgui.Columns(4)
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("ID машины")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(idCAR)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Двигатель")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_statusENG)); imgui.NextColumn()
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Скорость")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_vSpeed)); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("ХП машины")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_vHP))
- imgui.Columns(2)
- imgui.Separator()
- imgui.SetColumnWidth(-1, 80); imgui.Text(u8("Бензин")); imgui.NextColumn()
- imgui.SetColumnWidth(-1, 75); imgui.Text(u8(recon_fuel.." литров")); imgui.NextColumn()
- imgui.Columns(1)
- imgui.Separator()
- else
- VehName = "-"
- recon_statusENG = "-"
- recon_vSpeed = "-"
- recon_vHP = "-"
- recon_fuel = "-"
- end
- end
- if not sampIsDialogActive() then
- reconpanel()
- end
- if sampIsScoreboardOpen() or sampIsChatInputActive() or sampIsDialogActive() then
- imgui.CaptureMouseFromApp(false)
- end
- if hide_imguiCursor then
- lua_thread.create(function ()
- wait(100)
- imgui.ShowCursor = false
- hide_imguiCursor = false
- end)
- end
- imgui.End()
- --reconpanel1()
- end
- end
- function reconpanel()
- RPxPanel, RPyPanel = getScreenResolution()
- sizeX_reconPanel = 430
- imgui.SetNextWindowPos(imgui.ImVec2(RPxPanel / 2 - 223, RPyPanel / 1.238), imgui.ImVec2(0.5, 0.5))
- imgui.SetNextWindowSize(imgui.ImVec2(sizeX_reconPanel, 96))
- imgui.Begin(u8("##reconPanel2"), _, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoSavedSettings)
- --imgui.PushStyleVar(imgui.StyleVar.ItemSpacing, imgui.ImVec2(1, 2.5))
- xCord_back = sizeX_reconPanel / 2 - 50 / 2 - 52
- xCord_next = sizeX_reconPanel / 2 - 50 / 2 + 52
- xCord_reoff = sizeX_reconPanel / 2 - 45 / 2
- imgui.SetCursorPos(imgui.ImVec2(xCord_back, 5))
- if imgui.Button(u8("<< Back"), imgui.ImVec2(50, 25)) then
- sampSendChat("/re_prev")
- end
- imgui.SetCursorPos(imgui.ImVec2(xCord_reoff, 5))
- if imgui.Button(u8("REOFF"), imgui.ImVec2(45, 25)) then
- sampSendChat("/reoff")
- end
- imgui.SetCursorPos(imgui.ImVec2(xCord_next, 5))
- if imgui.Button(u8("Next >>"), imgui.ImVec2(50, 25)) then
- sampSendChat("/re_next")
- end
- imgui.BeginChild('Interaction player', imgui.ImVec2(421, 55), true)
- if imgui.Button(u8("Stats"), imgui.ImVec2(35, 20)) then
- sampSendChat("/check "..recon_ID)
- end
- imgui.SameLine(45)
- if imgui.Button(u8("Spawn"), imgui.ImVec2(45, 20)) then
- sampSendChat("/spplayer "..recon_ID)
- end
- imgui.SameLine(96)
- if imgui.Button(u8("Slap UP"), imgui.ImVec2(48, 20)) then
- sampSendChat("/slap "..recon_ID.." up")
- end
- imgui.SameLine(150)
- if imgui.Button(u8("Slap DOWN"), imgui.ImVec2(69, 20)) then
- sampSendChat("/slap "..recon_ID.." down")
- end
- imgui.SameLine(225)
- if imgui.Button(u8("Freeze"), imgui.ImVec2(45, 20)) then
- sampSendChat("/freeze "..recon_ID)
- end
- imgui.SameLine(276)
- if imgui.Button(u8("UnFreeze"), imgui.ImVec2(60, 20)) then
- sampSendChat("/unfreeze "..recon_ID)
- end
- imgui.SameLine(342)
- if imgui.Button(u8("setHP"), imgui.ImVec2(38, 20)) then
- if tonumber(my_lvl_adm) == 1 then
- sampSendChat("/a /sethp "..recon_ID.." 100")
- else
- sampSendChat("/sethp "..recon_ID.." 100")
- end
- end
- imgui.SameLine(386)
- if imgui.Button(u8("Flip"), imgui.ImVec2(28, 20)) then
- sampSendChat("/flip "..recon_ID)
- end
- if imgui.Button(u8("Goto"), imgui.ImVec2(33, 20)) then
- sampSendClickTextdraw(recon_TD_DEL + 22)
- end
- imgui.SameLine(43)
- if imgui.Button(u8("GetHere"), imgui.ImVec2(52, 20)) then
- if tonumber(my_lvl_adm) < 2 then
- SCM("Ваш уровень должен быть выше 1-го.")
- else
- lua_thread.create(function ()
- sampSendChat("/reoff")
- wait(800)
- sampSendChat("/gethere "..recon_ID)
- SCM("ID: " .. recon_ID .. " телепортирован к вам.")
- end)
- end
- end
- imgui.SameLine(101)
- if imgui.Button(u8("WarnLog"), imgui.ImVec2(57, 20)) then
- sampSendChat("/warnlog_pl "..recon_ID)
- end
- imgui.SameLine(164)
- if imgui.Button(u8("getIP"), imgui.ImVec2(35, 20)) then
- if tonumber(my_lvl_adm) < 2 then
- sampSendChat("/a /getip "..recon_ID)
- else
- sampSendChat("/getip "..recon_ID)
- recon_getipCheck = true
- end
- end
- imgui.SameLine(205)
- if imgui.Button(u8("PgetIP"), imgui.ImVec2(40, 20)) then
- if tonumber(my_lvl_adm) < 3 then
- sampSendChat("/a /pgetip "..recon_ID)
- else
- sampSendChat("/getip "..recon_ID)
- recon_PgetipCheck = true
- end
- end
- imgui.SameLine(251)
- if imgui.Button(u8("PLveh"), imgui.ImVec2(40, 20)) then
- if tonumber(my_lvl_adm) < 3 then
- sampSetChatInputEnabled(true)
- sampSetChatInputText("/a /plveh " .. recon_ID .. " ")
- else
- sampSetChatInputEnabled(true)
- sampSetChatInputText("/plveh " .. recon_ID .. " ")
- end
- end
- imgui.SameLine(297)
- if imgui.Button(u8("Weap"), imgui.ImVec2(37, 20)) then
- if tonumber(my_lvl_adm) == 1 then
- sampSendChat("/a /weap "..recon_ID)
- else
- sampSendChat("/weap "..recon_ID)
- recon_cmdWeap = true
- end
- end
- imgui.SameLine(340)
- if imgui.Button(u8("Вы тут?"), imgui.ImVec2(48, 20)) then
- sampSendChat("/checkbot "..recon_ID..", Вы тут?,Нет,Да,Нет")
- SCM("Вы кинули проверку на игрока "..recon_nickname.." ["..recon_ID.."]")
- end
- imgui.SameLine(394)
- if imgui.Button(u8("AZ"), imgui.ImVec2(22, 20)) then
- lua_thread.create(function ()
- sampSendChat("/reoff")
- wait(400)
- sampSendChat("/az "..recon_ID)
- SCM("Вы телепортировали "..recon_nickname.."["..recon_ID.."] в админ зону.")
- end)
- end
- imgui.EndChild()
- imgui.End()
- end
- ---------------------------UTILS
- function getMyID()
- _, myID = sampGetPlayerIdByCharHandle(playerPed)
- return myID
- end
- function SCM(msg)
- sampAddChatMessage("[RodinaTools] {FFFFFF}"..msg, 0xdeb226)
- end
- function sampGetPlayerIdByNickname(nick)
- local _, idbynick = sampGetPlayerIdByCharHandle(playerPed)
- if tostring(nick) == sampGetPlayerNickname(idbynick) then
- return idbynick
- end
- for id = 0, 800, 1 do
- if sampIsPlayerConnected(id) and sampGetPlayerNickname(id) == tostring(nick) then
- return id
- end
- end
- end
- function imgui.CenterColumnText(text)
- imgui.SetCursorPosX((imgui.GetColumnOffset() + (imgui.GetColumnWidth() / 2)) - imgui.CalcTextSize(text).x / 2)
- imgui.Text(text)
- end
- function uu()
- for i = 0,2 do
- tab[i] = false
- end
- end
- function checkStatsPlayerOTHER()
- if recon_timeCheckComplete <= os.time() then
- lua_thread.create(function ()
- wait(1500)
- if not sampIsDialogActive() and recon_ID ~= -1 and sampIsPlayerConnected(recon_ID) then
- recon_checkstats = true
- sampSendChat("/check " .. recon_ID)
- recon_checkComplete = true
- recon_timeCheckComplete = os.time() + 1
- end
- end)
- end
- end
- function delrec()
- -- 787 последний
- sampTextdrawDelete(recon_TD_DEL)
- sampTextdrawDelete(recon_TD_DEL + 1)
- sampTextdrawDelete(recon_TD_DEL + 2)
- sampTextdrawDelete(recon_TD_DEL + 3)
- sampTextdrawDelete(recon_TD_DEL + 4)
- sampTextdrawDelete(recon_TD_DEL + 5)
- sampTextdrawDelete(recon_TD_DEL + 6)
- sampTextdrawDelete(recon_TD_DEL + 7)
- sampTextdrawDelete(recon_TD_DEL + 8)
- sampTextdrawDelete(recon_TD_DEL + 9)
- sampTextdrawDelete(recon_TD_DEL + 10)
- sampTextdrawDelete(recon_TD_DEL + 11)
- sampTextdrawDelete(recon_TD_DEL + 12)
- sampTextdrawDelete(recon_TD_DEL + 13)
- sampTextdrawDelete(recon_TD_DEL + 14)
- sampTextdrawDelete(recon_TD_DEL + 15)
- sampTextdrawDelete(recon_TD_DEL + 16)
- sampTextdrawDelete(recon_TD_DEL + 17)
- sampTextdrawDelete(recon_TD_DEL + 18)
- sampTextdrawDelete(recon_TD_DEL + 19)
- sampTextdrawDelete(recon_TD_DEL + 20)
- sampTextdrawDelete(recon_TD_DEL + 21)
- sampTextdrawDelete(recon_TD_DEL + 22)
- sampTextdrawDelete(recon_TD_DEL + 23)
- sampTextdrawDelete(recon_TD_DEL + 24)
- sampTextdrawDelete(recon_TD_DEL + 25)
- sampTextdrawDelete(recon_TD_dop)
- sampTextdrawDelete(recon_TD_nickname)
- sampTextdrawDelete(recon_TD_main)
- end
- function sampGetPlayerSkin(id)
- if not id or not sampIsPlayerConnected(tonumber(id)) and not tonumber(id) == select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) then return false end
- local isLocalPlayer = tonumber(id) == select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))
- local result, handle = sampGetCharHandleBySampPlayerId(tonumber(id))
- if not result and not isLocalPlayer then return false end
- local skinid = getCharModel(isLocalPlayer and PLAYER_PED or handle)
- if skinid < 0 or skinid > 311 then return false end
- return true, skinid
- end
- function getCarName(TypeCar)
- if type(TypeCar) ~= "number" then
- return "No valid car id"
- end
- if TypeCar < 400 or TypeCar > 611 then
- return "No valid car id"
- end
- return CarName[TypeCar - 399]
- end
- function goupdate()
- SCM("Обнаружено обновление, загружаю новую версию. Использование скриптов AutoReload и AutoReboot будут конфликтовать")
- SCM("Текущая версия: "..thisScript().version..". Новая версия: "..version)
- print("[LOG] Производится обновление скрипта. Текущая версия: "..thisScript().version..". Новая версия: "..version)
- wait(300)
- downloadUrlToFile(updatelink, thisScript().path, function(id3, status1, p13, p23) -- качает ваш файлик с latest version
- if status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
- SCM("Обновление завершено, перезагружаю..")
- print("[LOG] Обновление завершено.")
- thisScript():reload()
- end
- end)
- end
- function update()
- local Updatefpath = os.getenv('TEMP') .. '\\check_UPD_RodinaTools.json'
- downloadUrlToFile('https://raw.githubusercontent.com/Glade412/RodinaToolsADM/master/autoupdate.json', Updatefpath, function(id, status, p1, p2)
- if status == dlstatus.STATUS_ENDDOWNLOADDATA then
- local f = io.open(Updatefpath, 'r')
- if f then
- local Updateinfo = decodeJson(f:read('*a'))
- updatelink = Updateinfo.updateurl
- if Updateinfo and Updateinfo.latest then
- version = tonumber(Updateinfo.latest) -- переводит версию в число
- if version > tonumber(thisScript().version) then -- если версия больше чем версия установленная то...
- lua_thread.create(goupdate) -- апдейт
- else -- если меньше, то
- print("[LOG] Используется актуальная версия - "..thisScript().version)
- update_ok = true
- end
- end
- end
- end
- end)
- end
- -----------------------------------
- function LIP.load(fileName)
- assert(type(fileName) == 'string', 'Parameter "fileName" must be a string.');
- local file = assert(io.open(fileName, 'r'), 'Error loading file : ' .. fileName);
- local data = {};
- local section;
- for line in file:lines() do
- local tempSection = line:match('^%[([^%[%]]+)%]$');
- if(tempSection)then
- section = tonumber(tempSection) and tonumber(tempSection) or tempSection;
- data[section] = data[section] or {};
- end
- local param, value = line:match('^([%w|_]+)%s-=%s-(.+)$');
- if(param and value ~= nil)then
- if(tonumber(value))then
- value = tonumber(value);
- elseif(value == 'true')then
- value = true;
- elseif(value == 'false')then
- value = false;
- end
- if(tonumber(param))then
- param = tonumber(param);
- end
- data[section][param] = value;
- end
- end
- file:close();
- return data;
- end
- function LIP.save(fileName, data)
- assert(type(fileName) == 'string', 'Parameter "fileName" must be a string.');
- assert(type(data) == 'table', 'Parameter "data" must be a table.');
- local file = assert(io.open(fileName, 'w+b'), 'Error loading file :' .. fileName);
- local contents = '';
- for section, param in pairs(data) do
- contents = contents .. ('[%s]\n'):format(section);
- for key, value in pairs(param) do
- contents = contents .. ('%s=%s\n'):format(key, tostring(value));
- end
- contents = contents .. '\n';
- end
- file:write(contents);
- file:close();
- end
- return LIP;
Add Comment
Please, Sign In to add comment