local version = 1.0 local sampev = require('lib.samp.events') local imgui = require 'mimgui' local ffi = require 'ffi' local hotkey = require('mimhotkey') local requests = require 'requests' local encoding = require 'encoding' encoding.default = 'CP1251' u8 = encoding.UTF8 local ad = require 'ADDONS' local fa = require('fAwesome6') local ini = { config = { ['carshotkeycheck'] = false, ['acshotkeycheck'] = false, ['infobar'] = false }, hotkey = { ['icon'] = '[101]', -- ['presset'] = '[52]', ['cars'] = '[52]', ['acs'] = '[58]', ['infobar'] = '[105]', }, autopr = { vrcheck = false, jcheck = false, famcheck = false, adcheck = false, vr = '', j = '', fam = '', ad = '', vrwait = 10, jwait = 10, famwait = 10, adwait = 30, adradio = 1, } } local blacklist = { blacklist = {} } local acs = { acs = {} } local stats = { salary = 0, time = 0, kolvo = 0, infobar = {}, posx = 100, posy = 500, } if not doesDirectoryExist('moonloader/config/Arenda Helper') then createDirectory('moonloader/config/Arenda Helper') end local configj = getGameDirectory()..'\\moonloader\\config\\Arenda Helper\\config.json' local blacklistj = getGameDirectory()..'\\moonloader\\config\\Arenda Helper\\blacklist.json' local acsj = getGameDirectory()..'\\moonloader\\config\\Arenda Helper\\acs.json' local statsj = getGameDirectory()..'\\moonloader\\config\\Arenda Helper\\stats.json' if not doesFileExist(configj) then local f = io.open(configj, 'w+') f:write(encodeJson(ini)):close() else local f = io.open(configj, "r") a = f:read("*a") ini = decodeJson(a) f:close() end if not doesFileExist(blacklistj) then local f = io.open(blacklistj, 'w+') f:write(encodeJson(blacklist)):close() else local f = io.open(blacklistj, "r") a = f:read("*a") blacklist = decodeJson(a) f:close() end if not doesFileExist(acsj) then local f = io.open(acsj, 'w+') f:write(encodeJson(acs)):close() else local f = io.open(acsj, "r") a = f:read("*a") acs = decodeJson(a) f:close() end if not doesFileExist(statsj) then local f = io.open(statsj, 'w+') f:write(encodeJson(stats)):close() else local f = io.open(statsj, "r") a = f:read("*a") stats = decodeJson(a) f:close() end function JSONSave() if doesFileExist(configj) then local f = io.open(configj, 'w+') if f then f:write(encodeJson(ini)):close() end end if doesFileExist(blacklistj) then local f = io.open(blacklistj, 'w+') if f then f:write(encodeJson(blacklist)):close() end end if doesFileExist(acsj) then local f = io.open(acsj, 'w+') if f then f:write(encodeJson(acs)):close() end end if doesFileExist(statsj) then local f = io.open(statsj, 'w+') if f then f:write(encodeJson(stats)):close() end end end local new, str, sizeof = imgui.new, ffi.string, ffi.sizeof local rent = nil icons = { globalicon = new.bool(), renticon = new.bool(), renticonhotkey = new.bool(), updateicon = new.bool(), infobar = new.bool(), } checkx = { blacklistcheck = new.bool(), rentcheck = new.bool(), carshotkeycheck = new.bool(ini.config.carshotkeycheck), acshotkeycheck = new.bool(ini.config.acshotkeycheck), infobar = new.bool(ini.config.infobar) } buffers = { blacklistnick = new.char[128](), blacklistreason = new.char[128](), blacklistid = new.int(), rentid = new.int(), rentprice = new.int(), renttime = new.int(), acsmodel = new.int(), acsname = new.char[128](), } others = { checkcars = false, menu = 1, menurent = new.int(1), modeaddacs = false, acsarenda = false, hotkey_func = false, move = false, } autopr = { vrcheck = new.bool(ini.autopr.vrcheck), jcheck = new.bool(ini.autopr.jcheck), famcheck = new.bool(ini.autopr.famcheck), adcheck = new.bool(ini.autopr.adcheck), j = new.char[128](u8(ini.autopr.j)), vr = new.char[128](u8(ini.autopr.vr)), fam = new.char[128](u8(ini.autopr.fam)), ad = new.char[128](u8(ini.autopr.ad)), jwait = new.int(ini.autopr.jwait), vrwait = new.int(ini.autopr.vrwait), famwait = new.int(ini.autopr.famwait), adwait = new.int(ini.autopr.adwait), adradio = new.int(1), delay = 0.5, } infoicon = { {name = '{FFA500}/renthelp {A9A9A9} - основное окно скрипта'}, {name = '{FFA500}/rentcars [ID]{A9A9A9} - быстрая сдача транспорта в аренду'}, {name = '{FFA500}/rentacs [ID]{A9A9A9} - быстрая сдача аксессуара в аренду'}, {name = '{FFA500}/bcheck [ID]{A9A9A9} - проверить на нахождение в ЧС'}, {name = '{FFA500}/badd [ID] [причина]{A9A9A9} - добавить человека в ЧС'}, {name = '{FFA500}/autopr{A9A9A9} - включить/выключить автопиар'}, } infoicon1 = { {name = '{FFA550}NUM5 {A9A9A9}- основное окно скрипта'}, {name = '{FFA550}NUM9 {A9A9A9}- инфобар (если включен)'}, {name = '{FFA550}ПКМ+R {A9A9A9}- быстрая сдача транспорта в аренду'}, {name = '{FFA500}ПКМ+Z {A9A9A9}- быстрая сдача аксессуара в аренду'} } senddraw = true adcheck1 = true blackerrorcheck = false local autopren = false url = requests.get("https://pastebin.com/raw/kNRtaDrJ") a = decodeJson(url.text) local iconhotkey = decodeJson(ini.hotkey.icon) local carshotkey = decodeJson(ini.hotkey.cars) local acshotkey = decodeJson(ini.hotkey.acs) local infobarhotkey = decodeJson(ini.hotkey.infobar) function main() while not isSampAvailable() do wait(0) end sampRegisterChatCommand('renthelp', function() icons.globalicon[0] = not icons.globalicon[0] end) sampRegisterChatCommand('infob',function() icons.infobar[0] = not icons.infobar[0] end) sampRegisterChatCommand('rentcars',function(arg) if #arg > 0 then id_func = tonumber(arg) menu_func = 2 others.hotkey_func = true icons.renticonhotkey[0] = true else sms('Введите ID игрока') end end) sampRegisterChatCommand('rentacs',function(arg) if #arg > 0 then id_func = tonumber(arg) menu_func = 3 others.hotkey_func = true icons.renticonhotkey[0] = true else sms('Введите ID игрока') end end) sampRegisterChatCommand('bcheck',function(arg) for index,id in pairs(blacklist.blacklist) do nameid = sampGetPlayerNickname(tonumber(arg)) if id.nick:find(nameid) then sms('Этот игрок в черном списке!') blackerrorcheck = true elseif not id.nick:find(nameid) then lua_thread.create(function() wait(1000) if not blackerrorcheck then sms('Игрок не находиться в черном списке!') end end) end end end) sampRegisterChatCommand('badd',function(arg) if arg:find('(.+) (.+)') then local arg1, arg2 = arg:match('(.+) (.+)') nick = sampGetPlayerNickname(arg1) table.insert(blacklist.blacklist, {nick = nick, reason = arg2}) JSONSave() sms('Игрок '..nick..' добавлен в черный список с причиной: '..arg2) else sms('Введите все параментры: /badd [ID] [причина]') end end) sampRegisterChatCommand('autopr',function() autopren = not autopren if autopren then piar_j1 = lua_thread.create(piar_j) piar_ad4 = lua_thread.create(piar_ad) --piar_vr1 = lua_thread.create(piar_vr) --piar_fam2 = lua_thread.create(piar_fam) adcheck1 = true else if piar_ad4 then piar_ad4:terminate() end if piar_j1 then piar_j1:terminate() end --if piar_vr1 then piar_vr1:terminate() end --if piar_fam2 then piar_fam2:terminate() end adcheck1 = false end if not autopr.vrcheck[0] and not autopr.famcheck[0] and not autopr.jcheck[0] and not autopr.adcheck[0] then sms('Не включено ни одной функции автопиара') autopren = false else sms(autopren and 'Автопиар включен!' or 'Автопиар выключен') end end) sampRegisterChatCommand('updaterh',function() icons.updateicon[0] = not icons.updateicon[0] end) hotkey.RegisterCallback('iconht', iconhotkey, function() if not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then icons.globalicon[0] = not icons.globalicon[0] end end) hotkey.RegisterCallback('carsht', carshotkey, carshotkey_func) hotkey.RegisterCallback('acsht', acshotkey, acshotkey_func) hotkey.RegisterCallback('infobarht', infobarhotkey, function() if not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then icons.infobar[0] = not icons.infobar[0] end end) hotkey.no_flood = false sms('Помощник аренды загружен. Активация {mc}/renthelp') while true do wait(0) if timerState then if timerStart and timerEndTime then timerEndTimeSec = timerEndTime * 60 showtime = timerEndTimeSec - (os.time() - timerStart) end end if others.move then showCursor(true, true) icons.globalicon[0] = false icons.infobar[0] = true stats.posx, stats.posy = getCursorPos() JSONSave() if isKeyJustPressed(0x20) then others.move = false icons.globalicon[0] = false JSONSave() sms('Позиция сохранена.') showCursor(false, false) end end end end carshotkey_func = function() if isKeyDown(2) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) if result then r, i = sampGetPlayerIdByCharHandle(ped) id_func = i menu_func = 2 others.hotkey_func = true icons.renticonhotkey[0] = true sms('ID выбранного игрока: '..i) end end end acshotkey_func = function() if isKeyDown(2) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) if result then r, i = sampGetPlayerIdByCharHandle(ped) id_func = i menu_func = 3 others.acsarenda = true others.hotkey_func = true icons.renticonhotkey[0] = true sms('ID выбранного игрока: '..i) end end end wsizex = 700 csizex = 480 local my_cars = {} local resX, resY = getScreenResolution() imgui.OnFrame(function() return icons.globalicon[0] end, function(player) --imgui.SetNextWindowSize(imgui.ImVec2(700, 410), imgui.Cond.Always) imgui.SetNextWindowSize(imgui.ImVec2(wsizex, 410), imgui.Cond.Always) imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5)) imgui.Begin("gobalic", icons.globalicon, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoScrollbar) if ad.PageButton(others.menu == 1,fa('circle_info'),u8'Информация') then others.menu = 1 end if ad.PageButton(others.menu == 2,fa('gears'),u8'Настройки') then others.menu = 2 end if ad.PageButton(others.menu == 3,fa('car_rear'),u8'Аренда') then others.menu = 3 end ad.PageButton(others.menu == 4,fa('rocket_launch'),u8'Прессеты [в разработке]') if ad.PageButton(others.menu == 5,fa('sack_dollar'),u8'Статистика') then others.menu = 5 end if ad.PageButton(others.menu == 6,fa('wand_magic_sparkles'),u8'Автопиар') then others.menu = 6 end if ad.PageButton(others.menu == 7,fa('blanket'),u8'Черный список') then others.menu = 7 end imgui.SameLine(210) imgui.SetCursorPosY(10) imgui.BeginChild('globalchild',imgui.ImVec2(csizex,390),true) if others.menu == 1 then imgui.TextColoredRGB('{FFA500}Rent Helper{A9A9A9} - скрипт для удобной сдачи транспорта и аксессуаров в аренду') imgui.SetCursorPos(imgui.ImVec2(180,50)) imgui.TextColoredRGB('{FFA500}Команды скрипта:') for index,id in pairs(infoicon) do imgui.TextColoredRGB(id.name) end imgui.SetCursorPos(imgui.ImVec2(140,200)) imgui.TextColoredRGB('{FFA550}Клавиши скрипта(по умолчанию):') for index,id in pairs(infoicon1) do imgui.TextColoredRGB(id.name) end imgui.SetCursorPosY(315) if imgui.Button(u8'Проверить обновления',imgui.ImVec2(-1,30)) then if tonumber(a["update"]) > version then sms('Доступно обновление {mc}'..a["update"]..'{mr}. Что бы обновить - введите {mc}/updaterh') else sms('Нет доступных обновлений.') end end if imgui.Button(u8'Тема на BlastHack',imgui.ImVec2(225,30)) then os.execute("start https://www.blast.hk/threads/184092/") end imgui.SameLine() if imgui.Button(u8'Если нашли баг',imgui.ImVec2(225-1,30)) then os.execute("start https://t.me/painwt0") end elseif others.menu == 2 then tkey = hotkey.KeyEditor('iconht', u8'Основное окно') if tkey then ini.hotkey.icon = encodeJson(tkey) end if imgui.Checkbox(u8'Аренда транспорта по кнопке',checkx.carshotkeycheck) then ini.config.carshotkeycheck = checkx.carshotkeycheck[0] end if checkx.carshotkeycheck[0] then imgui.SameLine() tkey1 = hotkey.KeyEditor('carsht', u8'ПКМ +') if tkey1 then ini.hotkey.cars = encodeJson(tkey1) end end if imgui.Checkbox(u8'Аренда аксессуаров по кнопке',checkx.acshotkeycheck) then ini.config.acshotkeycheck = checkx.acshotkeycheck[0] end if checkx.acshotkeycheck[0] then imgui.SameLine() tkey2 = hotkey.KeyEditor('acsht', u8'ПКМ +') if tkey2 then ini.hotkey.acs = encodeJson(tkey2) end end imgui.Separator() if imgui.Checkbox(u8'Инфобар о сдаче в аренду',checkx.infobar) then ini.config.infobar = checkx.infobar[0] end if checkx.infobar[0] then tkey3 = hotkey.KeyEditor('infobarht', u8'Кнопка инфобара') if tkey3 then ini.hotkey.infobar = encodeJson(tkey3) end if imgui.Button(u8'Изменить положение инфобара') then others.move = true end end JSONSave() elseif others.menu == 3 then imgui.SetCursorPosX(170) if ad.HeaderButton(others.menurent[0] == 1, u8'Машины') then others.menurent[0] = 1 end imgui.SameLine() if ad.HeaderButton(others.menurent[0] == 2, u8'Аксессуары') then others.menurent[0] = 2 end imgui.SetCursorPosY(35) if others.menurent[0] == 1 then if imgui.Button(u8'Обновить список авто',imgui.ImVec2(-1,30)) then others.checkcars = true my_cars = {} sampSendChat('/cars') end imgui.BeginChild('cars',imgui.ImVec2(-1,310),true) for k, v in ipairs(my_cars) do if imgui.Button(u8(v) .. '##' .. k, imgui.ImVec2(-1,25)) and not v:find('В аренде') then rent = v namecar = v icons.renticon[0] = true icons.globalicon[0] = false end end imgui.EndChild() elseif others.menurent[0] == 2 then if imgui.CollapsingHeader(u8'ГАЙД по добавлению аксессуара') then imgui.TextColoredRGB('{f24663}ГАЙД {ffffff}по добавлению аксессуара в список аренды:') imgui.TextColoredRGB('{ffffff}Необходимо включить режим {49f246}добавления {ffffff}внизу по кнопке, открыть \n {ffffff}инвентарь и нажать на нужный вам аксессуар, в чате появиться {f24663} ID{ffffff} модели, \nего необходимо вписать в поле ниже.') if imgui.Button(others.modeaddacs and u8'Выключить режим добавления' or u8'Включить режим добавления') then others.modeaddacs = not others.modeaddacs end end imgui.BeginChild('addacs',imgui.ImVec2(-1,100),true) imgui.InputTextWithHint('##nameacs',u8'Название аксессуара',buffers.acsname,128) imgui.InputInt(u8'ID модели',buffers.acsmodel) if imgui.Button(u8'Добавить аксессуар',imgui.ImVec2(-1,25)) then if #str(buffers.acsname) > 0 and buffers.acsmodel[0] > 0 then table.insert(acs.acs,{name = u8:decode(str(buffers.acsname)), model = buffers.acsmodel[0]}) JSONSave() end end imgui.EndChild() for index,id in pairs(acs.acs) do if imgui.Button(u8(id.name)..' | '..id.model,imgui.ImVec2(-1-35,25)) then others.acsarenda = true modelidacs = id.model senddraw = true icons.globalicon[0] = false icons.renticon[0] = true end imgui.SameLine() if imgui.Button('X##'..index,imgui.ImVec2(25,25)) then table.remove(acs.acs,index) end end end elseif others.menu == 4 then elseif others.menu == 5 then wsizex = 1000 csizex = 780 imgui.TextColoredRGB('{ffffff}Заработано: {7FFF00}'..separator(stats.salary)..'$') imgui.TextColoredRGB('{ffffff}Сдано времени: '..stats.time..'ч') imgui.TextColoredRGB('{ffffff}Сдано раз: '..stats.kolvo..' раз') imgui.BeginChild('##stats',imgui.ImVec2(-1,310),true) for index,id in pairs(stats.infobar) do imgui.Text('['..id.date..' '..id.time..'] '..u8(id.action)) end imgui.EndChild() elseif others.menu == 6 then imgui.CenterText(u8'Пиар в /vr') if imgui.Checkbox('##vr1',autopr.vrcheck) then ini.autopr.vrcheck = autopr.vrcheck[0] end imgui.SameLine() imgui.PushItemWidth(430) if imgui.InputTextWithHint('##vr',u8'Текст в vr',autopr.vr,200) then ini.autopr.vr = u8:decode(str(autopr.vr)) end if imgui.SliderInt(u8'Wait##1',autopr.vrwait,10,240) then ini.autopr.vrwait = autopr.vrwait[0] end imgui.Separator() imgui.CenterText(u8'Пиар в /fam') if imgui.Checkbox('##fam1',autopr.famcheck) then ini.autopr.famcheck = autopr.famcheck[0] end imgui.SameLine() imgui.PushItemWidth(430) if imgui.InputTextWithHint('##fam',u8'Текст в fam',autopr.fam,200) then ini.autopr.fam = u8:decode(str(autopr.fam)) end if imgui.SliderInt(u8'Wait##2',autopr.famwait,10,240) then ini.autopr.famwait = autopr.famwait[0] end imgui.Separator() imgui.CenterText(u8'Пиар в /j') if imgui.Checkbox('##j1',autopr.jcheck) then ini.autopr.jcheck = autopr.jcheck[0] end imgui.SameLine() imgui.PushItemWidth(430) if imgui.InputTextWithHint('##j',u8'Текст в j',autopr.j,200) then ini.autopr.j = u8:decode(str(autopr.j)) end if imgui.SliderInt(u8'Wait##3',autopr.jwait,10,240) then ini.autopr.jwait = autopr.jwait[0] end imgui.Separator() imgui.CenterText(u8'Пиар в /ad') if imgui.Checkbox('##ad1',autopr.adcheck) then ini.autopr.adcheck = autopr.adcheck[0] end imgui.SameLine() imgui.PushItemWidth(430) if imgui.InputTextWithHint('##ad',u8'Текст в ad',autopr.ad,200) then ini.autopr.ad = u8:decode(str(autopr.ad)) end if imgui.SliderInt(u8'Wait##4',autopr.adwait,30,240) then ini.autopr.adwait = autopr.adwait[0] end JSONSave() if imgui.Button(u8(autopren and 'Выключить автопиар' or 'Включить автопиар'),imgui.ImVec2(-1,30)) then autopren = not autopren if autopren then if autopr.jcheck[0] then piar_j1 = lua_thread.create(piar_j) end if autopr.adcheck[0] then piar_ad4 = lua_thread.create(piar_ad) end if autopr.vrcheck[0] then piar_vr1 = lua_thread.create(piar_vr) end if autopr.famcheck[0] then piar_fam2 = lua_thread.create(piar_fam) end adcheck1 = true else if piar_ad4 then piar_ad4:terminate() end if piar_j1 then piar_j1:terminate() end if piar_vr1 then piar_vr1:terminate() end if piar_fam2 then piar_fam2:terminate() end adcheck1 = false end if not autopr.vrcheck[0] and not autopr.famcheck[0] and not autopr.jcheck[0] and not autopr.adcheck[0] then sms('Не включено ни одной функции автопиара') autopren = false else sms(autopren and 'Автопиар включен!' or 'Автопиар выключен') end end elseif others.menu == 7 then imgui.BeginChild('blacklist',imgui.ImVec2(-1,128),true) imgui.Checkbox(u8'Записать ник по ID',checkx.blacklistcheck) if checkx.blacklistcheck[0] then imgui.InputInt(u8'ID',buffers.blacklistid) else imgui.InputTextWithHint('##name',u8'Никнейм игрока',buffers.blacklistnick,128) end imgui.InputTextWithHint('##reason',u8'Причина занесения',buffers.blacklistreason,128) if imgui.Button(u8'Занести в список',imgui.ImVec2(-1,25)) and #ffi.string(buffers.blacklistreason) > 0 then if checkx.blacklistcheck[0] and buffers.blacklistid[0] >= 0 and buffers.blacklistid[0] < 999 then nick = sampGetPlayerNickname(buffers.blacklistid[0]) table.insert(blacklist.blacklist, {nick = nick, reason = u8:decode(ffi.string(buffers.blacklistreason))}) elseif not checkx.blacklistcheck[0] and #buffers.blacklistnick[0] > 0 then table.insert(blacklist.blacklist, {nick = u8:decode(ffi.string(buffers.blacklistnick)), reason = u8:decode(ffi.string(buffers.blacklistreason))}) end JSONSave() end imgui.EndChild() for index,id in pairs(blacklist.blacklist) do imgui.Button(u8'Ник: '..id.nick..u8' | Причина: '..u8(id.reason),imgui.ImVec2(-1-35,25)) imgui.SameLine() if imgui.Button('X##'..index,imgui.ImVec2(25,25)) then table.remove(blacklist.blacklist,index) JSONSave() end end end if others.menu == 5 then wsizex = 1000 csizex = 780 else wsizex = 700 csizex = 480 end imgui.EndChild() imgui.End() end ) function piar_ad() wait(1500) while autopren do if autopr.adcheck[0] and adcheck1 then sampSendChat("/ad " .. ini.autopr.ad) adcheck1 = false end wait(5000) end end function piar_fam() while autopren do if autopr.famcheck[0] then sampSendChat("/fam " .. ini.autopr.fam) end wait(autopr.famwait[0]*1000) end end function piar_j() wait(500) while autopren do if autopr.jcheck[0] then sampSendChat("/j " .. ini.autopr.j) end wait(autopr.jwait[0]*1000) end end function piar_vr() wait(2300) while autopren do if autopr.vrcheck[0] then sampSendChat("/vr " .. ini.autopr.vr) wait(autopr.vrwait[0]*1000) end end end imgui.OnFrame(function() return icons.renticon[0] end, function(player) imgui.SetNextWindowSize(imgui.ImVec2(320, 160), imgui.Cond.Always) imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5)) imgui.Begin("rent", renticon, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize) if others.hotkey_func then buffers.rentid[0] = id_func imgui.InputInt('ID',buffers.rentid,0,999) else imgui.InputInt('ID',buffers.rentid,0,999) end imgui.SameLine(280) if imgui.Button('X',imgui.ImVec2(25,25)) then rent = nil icons.renticon[0] = false icons.globalicon[0] = true others.hotkey_func = false others.acsarenda = false end imgui.InputInt(u8'Цена за час',buffers.rentprice) imgui.InputInt(u8'Кол-во часов',buffers.renttime) if imgui.Button(u8'Сдать в аренду',imgui.ImVec2(-1,30)) then for index,id in pairs(blacklist.blacklist) do nameid = sampGetPlayerNickname(buffers.rentid[0]) if id.nick:find(nameid) then sms('Этот игрок в черном списке!') blackerror = true elseif not id.nick:find(nameid) then lua_thread.create(function() wait(1000) if not blackerror then if others.acsarenda then sampSendChat('/invent') else sampSendChat('/cars') end icons.renticon[0] = false end end) end end end if blackerror then if imgui.Button(u8'Все равно сдать', imgui.ImVec2(-1,30)) then if others.acsarenda then sampSendChat('/invent') else sampSendChat('/cars') end icons.renticon[0] = false blackerror = false end end imgui.End() end ) imgui.OnFrame(function() return icons.renticonhotkey[0] end, function(player) imgui.SetNextWindowSize(imgui.ImVec2(250, 350), imgui.Cond.Always) imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5)) imgui.Begin("rent", renticonhotkey, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize) if menu_func == 2 then if imgui.Button(u8'Обновить список авто',imgui.ImVec2(-1-40,30)) then others.checkcars = true my_cars = {} sampSendChat('/cars') end imgui.SameLine() if imgui.Button('X',imgui.ImVec2(30,30)) then rent = nil icons.renticonhotkey[0] = false others.hotkey_func = false end imgui.BeginChild('cars',imgui.ImVec2(-1,295),true) for k, v in ipairs(my_cars) do if imgui.Button(u8(v) .. '##' .. k, imgui.ImVec2(-1,25)) and not v:find('В аренде') then rent = v namecar = v icons.renticon[0] = true icons.renticonhotkey[0] = false end end imgui.EndChild() elseif menu_func == 3 then if imgui.Button('X',imgui.ImVec2(30,30)) then rent = nil icons.renticonhotkey[0] = false others.hotkey_func = false end for index,id in pairs(acs.acs) do if imgui.Button(u8(id.name)..' | '..id.model,imgui.ImVec2(-1,25)) then others.acsarenda = true modelidacs = id.model senddraw = true icons.renticonhotkey[0] = false icons.renticon[0] = true end end end imgui.End() end ) local showtime = 0 imgui.OnFrame(function() return icons.infobar[0] end, function(player) if checkx.infobar[0] then imgui.SetNextWindowSize(imgui.ImVec2(-1, -1), imgui.Cond.Always) imgui.SetNextWindowPos(imgui.ImVec2(stats.posx, stats.posy), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5)) imgui.Begin("rent", renticonhotkey, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.AlwaysAutoResize) imgui.CenterText(u8'До конца аренды:') for index,id in pairs(stats.infobar) do denos = (id.den1 - os.date('%d')*24*60 ) + (id.den2 - os.date('%H')*60) + (id.den3 - os.date('%M')) imgui.Text(id.carname..': '..FormatTime(denos)) --table.insert(stats.infobar,{den = denc,chas = chasyac,min = os.date('%M')}) if denos == 0 then sms('Аренда '..id.carname..' окончена, вы можете сдать его снова.') table.remove(stats.infobar,index) end end imgui.End() end end ).HideCursor = true function sampev.onServerMessage(color, text) if text:find('{ffffff}Повторно предложить аренду можно через 00:(%d+)') then timeerror = text:match('{ffffff}Повторно предложить аренду можно через 00:(%d+)') sms('Вы можете предложить аренду игроку через '..timeerror..' секунд') rent = nil end if text:find('в аренду игроку %a+_%a+%[ID%: %d+%] на %d+ч за $(%d+)') then --Вы передали DFT в аренду игроку Ahmed_Arnee[ID: 954] на 3ч за $51123131 local chasy,pricerent = text:match('в аренду игроку %a+_%a+%[ID%: %d+%] на (%d+)ч за $(%d+)') local chasya = os.date('%H') + chasy local den = os.date('%d') if chasya > 24 and 24 < chasya then denc = den + 1 chasyac = chasya - 24 end if chasya > 48 and 48 < chasya then denc = den + 2 chasyac = chasya - 48 end if chasya > 72 and 72 < chasya then denc = den + 3 chasyac = chasya - 72 end if chasya > 24 then table.insert(stats.infobar,{den1 = denc*24*60, den2 = chasyac*60, den3 = os.date('%M'),carname = namecar,action = text,time = os.date('%X'),date = os.date('%x')}) end if chasya < 24 then table.insert(stats.infobar,{den1 = den*24*60, den2 = chasya*60, den3 = os.date('%M'),carname = namecar,action = text,time = os.date('%X'),date = os.date('%x')}) end --table.insert(stats.stats,{action = text,time = os.date('%X'),date = os.date('%x')}) --table.insert(stats.infobar,{carname = namecar,renttime = timerent}) stats.salary = stats.salary + pricerent icons.infobar[0] = true timerStart = os.time() timerEndTime = denos timerState = true timerstateF = true stats.kolvo = stats.kolvo + 1 stats.time = stats.time + chasy JSONSave() end _, idad = sampGetPlayerIdByCharHandle(PLAYER_PED) nickad = sampGetPlayerNickname(idad) if text:find(nickad..'%[%d+%] Тел. %d+') and autopren and autopr.adcheck[0] then lua_thread.create(function() wait(autopr.adwait[0]*1000) adcheck1 = true end) end if text:find('Игрок должен быть рядом с вами') then sms('ad') rent = nil others.acsarenda = false others.hotkey_func = false end end function sampev.onShowDialog(id, style, title, button1, button2, text) if others.checkcars then if title:find('Мой транспорт') then for line in text:gmatch('[^\n]+') do if not line:find('Не загружено') then table.insert(my_cars, line:match('(.+%(%d+%))')) end end sampSendDialogResponse(id, 0) others.checkcars = false return false else sms('Обновление списка авто было прервано!') end end if rent ~= nil then if title:find('^{BFBBBA}Мой транспорт$') then local find_line = getLineOnTextDialog(text, rent) if find_line ~= nil then sampSendDialogResponse(id, 1, find_line) else sms('Не удалось найти авто!'); rent = nil sampSendDialogResponse(id, 0) end return false elseif title:find('^{BFBBBA}Инструменты для .+$') then local find_line = getLineOnTextDialog(text, 'Сдать в аренду') if find_line ~= nil then sampSendDialogResponse(id, 1, find_line) else sms('Не удалось найти строчку для сдачи авто!'); rent = nil sampSendDialogResponse(id, 0) end return false elseif title:find('^{BFBBBA}Сдача в аренду$') then sampSendDialogResponse(id, 1, nil, string.format('%s, %s, %s',others.hotkey_func and id_func or buffers.rentid[0], buffers.rentprice[0], buffers.renttime[0])); rent = nil others.hotkey_func = false return false else sms('Сдача в аренду была прервана!'); rent = nil end end if others.acsarenda then if text:find('Вы действительно хотите') then sampSendDialogResponse(25675,1,-1,others.hotkey_func and id_func or buffers.rentid[0]) return false elseif text:find('На сколько часов') then sampSendDialogResponse(25676,1,-1,buffers.renttime[0]) return false elseif text:find('Введите сумму за') then sampSendDialogResponse(25677,1,-1,buffers.rentprice[0]) others.acsarenda = false buffers.rentid[0] = 0 buffers.renttime[0] = 0 buffers.rentprice[0] = 0 others.hotkey_func = false return false end end if autopr.adcheck[0] and autopren then count = 0 if title:find('Выберите радиостанцию') then for n in text:gmatch('[^\n]+') do if n:find('(%d+)сек назад') and not n:find('(%d+)мин (%d+)сек назад') then sampSendDialogResponse(id, -1, count, '') return false end count = count + 1 end elseif title:find('Подача объявления') then sampSendDialogResponse(id,1,0,-1) return false end end if autopr.vrcheck[0] and autopren then if id == 25630 then sampSendDialogResponse(id,1,-1,-1) return false end end end imgui.OnFrame(function() return icons.updateicon[0] end, function(player) imgui.SetNextWindowSize(imgui.ImVec2(-1, -1), imgui.Cond.Always) imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5)) imgui.Begin("update", farmericon, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoResize + imgui.WindowFlags.AlwaysAutoResize) if tonumber(a["update"]) > version then imgui.CenterText(u8'Доступно новое обновление.') imgui.SetCursorPosY(50) imgui.CenterText(u8'Изменения:') imgui.Text(a["news"]) imgui.BeginChild('##3', imgui.ImVec2(-1,35), true) imgui.SetCursorPosX(70) imgui.CenterText(u8'Cкачать:') imgui.SameLine() imgui.Link('https://www.blast.hk/threads/184092/','BlastHack') imgui.EndChild() else imgui.CenterText(u8'Нет доступных обновлений') end imgui.End() end ) function sampev.onShowTextDraw(idt, data) lua_thread.create(function() if others.acsarenda then for id,v in pairs(getAllTextdraws()) do if v.modelId == modelidacs then wait(1000) if senddraw then sampSendClickTextdraw(id) senddraw = false end if idt == 2300 then wait(1000) sampSendClickTextdraw(2300) sampSendClickTextdraw(0xFFFF) end end end end end) end function sampev.onSendClickTextDraw(textdrawId) if others.modeaddacs then mode, roX, roY, roZ, zom, colo1, colo2 = sampTextdrawGetModelRotationZoomVehColor(textdrawId) sms('ID модели: '..mode..'. Впишите его в поле для добавления аксессуара!') end end --others imgui.OnInitialize(function() imgui.DarkTheme() imgui.GetIO().IniFilename = nil local config = imgui.ImFontConfig() config.MergeMode = true config.PixelSnapH = true iconRanges = imgui.new.ImWchar[3](fa.min_range, fa.max_range, 0) imgui.GetIO().Fonts:AddFontFromMemoryCompressedBase85TTF(fa.get_font_data_base85('regular'), 15, config, iconRanges) -- solid - тип иконок, так же есть thin, regular, light и duotone end) function sms(text) local text = tostring(text):gsub('{mc}', '{FFA500}'):gsub('{mr}', '{FFFFFF}') sampAddChatMessage(string.format('[%s] {FFFFFF}%s', thisScript().name, text), 0xA9A9A9) end function getLineOnTextDialog(text, line_find) local count_dialog, text = 0, text for line in text:gmatch('[^\n]+') do count_dialog = count_dialog + 1 if string.find(line, line_find, 0, true) then return count_dialog - 1 end end return nil end function separator(n) local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') return left..(num:reverse():gsub('(%d%d%d)','%1.'):reverse())..right end function FormatTime(time) local timezone_offset = 86400 - os.date('%H', 0) * 3600 local time = time + timezone_offset return os.date((os.date("%H",time) == "00" and '%M:%S' or '%H:%M:%S'), time) end function imgui.CenterText(text) imgui.SetCursorPosX(imgui.GetWindowSize().x / 2 - imgui.CalcTextSize(text).x / 2) imgui.Text(text) end function imgui.Link(link, text) text = text or link local tSize = imgui.CalcTextSize(text) local p = imgui.GetCursorScreenPos() local DL = imgui.GetWindowDrawList() local col = { 0xFFFF7700, 0xFFFF9900 } if imgui.InvisibleButton("##" .. link, tSize) then os.execute("explorer " .. link) end local color = imgui.IsItemHovered() and col[1] or col[2] DL:AddText(p, color, text) DL:AddLine(imgui.ImVec2(p.x, p.y + tSize.y), imgui.ImVec2(p.x + tSize.x, p.y + tSize.y), color) end function getAllTextdraws() local vector3d = require 'vector3d' local res = {} for id = 1,5000 do if sampTextdrawIsExists(id) then local model, rotX, rotY, rotZ, zoom, clr1, clr2 = sampTextdrawGetModelRotationZoomVehColor(id) local box, color, sizeX, sizeY = sampTextdrawGetBoxEnabledColorAndSize(id) local letterX,letterY,letterColor = sampTextdrawGetLetterSizeAndColor(id) local shadow,shadowColor = sampTextdrawGetShadowColor(id) local outline,outlineColor = sampTextdrawGetOutlineColor(id) local x,y = sampTextdrawGetPos(id) res[id] = { text = sampTextdrawGetString(id), modelId = model, rotation = vector3d(x,y,z), box = box, boxColor = boxColor, boxSize = {x=sizeX,y=sizeY}, letterSize = {x=letterX,y=letterY}, letterColor = letterColor, shadow = shadow, shadowColor = shadowColor, outline = outline, outlineColor = outlineColor, position = {x=x,y=y}, } end end return res end 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.ImVec4(r/255, g/255, b/255, a/255) 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 imgui.DarkTheme() imgui.SwitchContext() local style = imgui.GetStyle() local colors = style.Colors local clr = imgui.Col local ImVec4 = imgui.ImVec4 --==[ STYLE ]==-- imgui.GetStyle().WindowPadding = imgui.ImVec2(10, 10) imgui.GetStyle().FramePadding = imgui.ImVec2(5, 4) imgui.GetStyle().ItemSpacing = imgui.ImVec2(10, 5) imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(2, 2) imgui.GetStyle().TouchExtraPadding = imgui.ImVec2(0, 0) imgui.GetStyle().IndentSpacing = 0 imgui.GetStyle().ScrollbarSize = 10 imgui.GetStyle().GrabMinSize = 10 --==[ BORDER ]==-- imgui.GetStyle().WindowBorderSize = 1 imgui.GetStyle().ChildBorderSize = 1 imgui.GetStyle().PopupBorderSize = 1 imgui.GetStyle().FrameBorderSize = 1 imgui.GetStyle().TabBorderSize = 1 --==[ ROUNDING ]==-- imgui.GetStyle().WindowRounding = 4 imgui.GetStyle().ChildRounding = 2 imgui.GetStyle().FrameRounding = 2 imgui.GetStyle().PopupRounding = 5 imgui.GetStyle().ScrollbarRounding = 0 imgui.GetStyle().GrabRounding = 1 imgui.GetStyle().TabRounding = 5 --==[ ALIGN ]==-- imgui.GetStyle().WindowTitleAlign = imgui.ImVec2(0.5, 0.5) imgui.GetStyle().ButtonTextAlign = imgui.ImVec2(0.5, 0.5) imgui.GetStyle().SelectableTextAlign = imgui.ImVec2(0.5, 0.5) --==[ COLORS ]==-- colors[clr.Text] = ImVec4(0.92, 0.92, 0.92, 1.00) colors[clr.TextDisabled] = ImVec4(0.44, 0.44, 0.44, 1.00) colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 1.00) colors[clr.ChildBg] = ImVec4(0.00, 0.00, 0.00, 0.00) colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94) colors[clr.Border] = ImVec4(0.51, 0.36, 0.15, 1.00) colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00) colors[clr.FrameBg] = ImVec4(0.11, 0.11, 0.11, 1.00) colors[clr.FrameBgHovered] = ImVec4(0.51, 0.36, 0.15, 1.00) colors[clr.FrameBgActive] = ImVec4(0.78, 0.55, 0.21, 1.00) colors[clr.TitleBg] = ImVec4(0.51, 0.36, 0.15, 1.00) colors[clr.TitleBgActive] = ImVec4(0.91, 0.64, 0.13, 1.00) colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51) colors[clr.MenuBarBg] = ImVec4(0.11, 0.11, 0.11, 1.00) colors[clr.ScrollbarBg] = ImVec4(0.06, 0.06, 0.06, 0.53) colors[clr.ScrollbarGrab] = ImVec4(0.21, 0.21, 0.21, 1.00) colors[clr.ScrollbarGrabHovered] = ImVec4(0.47, 0.47, 0.47, 1.00) colors[clr.ScrollbarGrabActive] = ImVec4(0.81, 0.83, 0.81, 1.00) colors[clr.CheckMark] = ImVec4(0.78, 0.55, 0.21, 1.00) colors[clr.SliderGrab] = ImVec4(0.91, 0.64, 0.13, 1.00) colors[clr.SliderGrabActive] = ImVec4(0.91, 0.64, 0.13, 1.00) colors[clr.Button] = ImVec4(0.51, 0.36, 0.15, 1.00) colors[clr.ButtonHovered] = ImVec4(0.91, 0.64, 0.13, 1.00) colors[clr.ButtonActive] = ImVec4(0.78, 0.55, 0.21, 1.00) colors[clr.Header] = ImVec4(0.51, 0.36, 0.15, 1.00) colors[clr.HeaderHovered] = ImVec4(0.91, 0.64, 0.13, 1.00) colors[clr.HeaderActive] = ImVec4(0.93, 0.65, 0.14, 1.00) colors[clr.Separator] = ImVec4(0.21, 0.21, 0.21, 1.00) colors[clr.SeparatorHovered] = ImVec4(0.91, 0.64, 0.13, 1.00) colors[clr.SeparatorActive] = ImVec4(0.78, 0.55, 0.21, 1.00) colors[clr.ResizeGrip] = ImVec4(0.21, 0.21, 0.21, 1.00) colors[clr.ResizeGripHovered] = ImVec4(0.91, 0.64, 0.13, 1.00) colors[clr.ResizeGripActive] = ImVec4(0.78, 0.55, 0.21, 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.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35) colors[clr.ModalWindowDimBg] = ImVec4(0.80, 0.80, 0.80, 0.35) end