Advertisement
SlonPvpru

[DRP] VMF v0.1.6

Jun 4th, 2020
1,011
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 57.46 KB | None | 0 0
  1. -- https://vk.com/diamond_inc
  2.  
  3. script_version("0.1.6")
  4. ----------------Инклуды-----------------------
  5. require "lib.moonloader"
  6. require "lib.sampfuncs"
  7. local memory = require "memory"
  8. local inicfg = require 'inicfg'
  9. local imgui = require 'imgui'
  10. local encoding = require 'encoding'
  11. local sampev = require 'lib.samp.events'
  12. local pie = require 'imgui_piemenu'
  13. local bNotf, notf = pcall(import, "imgui_notf.lua")
  14. local vkeys = require 'vkeys'
  15. local rkeys = require 'rkeys'
  16. encoding.default = 'CP1251'
  17. u8 = encoding.UTF8
  18. imgui.ToggleButton = require('imgui_addons').ToggleButton
  19. imgui.HotKey = require('imgui_addons').HotKey
  20. imgui.Spinner = require('imgui_addons').Spinner
  21. imgui.BufferingBar = require('imgui_addons').BufferingBar
  22. local binder =
  23. {
  24.     binders=
  25.     {
  26.         {
  27.             name = u8'Военная присяга',
  28.             wait = 2000,
  29.             key = {18,49},
  30.             lines =
  31.             {
  32.                 'Я, myname, торжественно присягаю на верность своему Отечеству — Триллианту!',
  33.                 'Клянусь свято соблюдать Конституцию Триллианта',
  34.                 'Строго выполнять требования воинских уставов, приказы командиров и начальников!',
  35.                 'Клянусь достойно исполнять воинский долг, мужественно защищать свободу',
  36.                 'Независимость и конституционный строй Триллианта, народ и Отечество!'
  37.             }
  38.         }
  39.     }
  40. }
  41. local default_key = {v={vkeys[0]}}
  42. local binder_select = 1
  43. local iScreenWidth, iScreenHeight = getScreenResolution()
  44. local binder_create_name = imgui.ImBuffer(256)
  45. local binder_create_key = {}
  46. local binder_create_wait = imgui.ImInt(1000)
  47. local select_bind = 0
  48. local binder_create_lines = {
  49.     imgui.ImBuffer(256),
  50.     imgui.ImBuffer(256),
  51.     imgui.ImBuffer(256)
  52. }
  53. ----------------Формирование конфигов-----------------------
  54. if not doesFileExist('moonloader\\config\\MOMonster\\MOMonster.ini') then
  55.     if not doesDirectoryExist('moonloader\\config\\MOMonster') then  createDirectory('moonloader\\config\\MOMonster') end
  56.     local  ini =
  57.     {
  58.             config =
  59.             {
  60.                     sex    = 0
  61.             }
  62.     }
  63. inicfg.save(ini, 'MOMonster\\MOMonster')
  64. end
  65. local directIni = 'moonloader\\config\\MOMonster\\MOMonster.ini'
  66. local mainIni = inicfg.load(nil, directIni)
  67. local check_my = true
  68. local check_find = true
  69. local my = {}
  70. local head_rang = {}
  71. local posts = {}
  72. local auth = false
  73. local find_stats = {}
  74. find_stats['online'] = {}
  75. local window_post = {}
  76. local so_post = false
  77. local tab_id = -1
  78. local find = {}
  79. local select_find = {}
  80. local input_gnews = {}
  81. local go_armor = false
  82. local rangs = {'Матрос','Старшина','Мичман','Младший Лейтенант','Лейтенант','Старший Лейтенант','Капитан-Лейтенант','Капитан 3-го ранга','Капитан 2-го ранга','Капитан 1-го ранга','Вице-Адмирал','Адмирал'}
  83. local binder_tags = {}
  84. ----------------Регистрация переменных IMGUI-----------------------
  85. local moset_window = imgui.ImBool(false)
  86. local hud = imgui.ImBool((mainIni.config.hud == true ))
  87. local find_window = imgui.ImBool(false)
  88. local window_state_tab = imgui.ImBool(false)
  89. local window_so = imgui.ImBool(false)
  90. find_stats['ВВО'] = imgui.ImBool(true)
  91. find_stats['СНБ'] = imgui.ImBool(true)
  92. find_stats['Штаб'] = imgui.ImBool(true)
  93. find_stats['БО'] = imgui.ImBool(true)
  94. find_stats['НБ'] = imgui.ImBool(true)
  95. find_stats['СНБ'] = imgui.ImBool(true)
  96. local sex = imgui.ImInt((mainIni.config.sex==0 and 0 or 1 ))
  97. local windows_gnews = imgui.ImBool(false)
  98. local position = imgui.ImInt((mainIni.config.position and mainIni.config.position or 0))
  99. local input_prefix_f = imgui.ImBuffer((mainIni.config.prefix_f and mainIni.config.prefix_f or ''),256)
  100. local input_prefix_r = imgui.ImBuffer((mainIni.config.prefix_r and mainIni.config.prefix_r or ''),256)
  101. local input_acent = imgui.ImBuffer((mainIni.config.acent and mainIni.config.acent or ''),256)
  102. local stats_post = imgui.ImBool((mainIni.config.stats_post == true ))
  103. local stats_head_rang = imgui.ImBool((mainIni.config.stats_head_rang == true ))
  104. local wait_head = imgui.ImInt((mainIni.config.wait_head and mainIni.config.wait_head or 120))
  105. local stats_eat = imgui.ImBool((mainIni.config.stats_eat == true ))
  106. local stats_screen = imgui.ImBool((mainIni.config.stats_screen == true ))
  107. local stats_armor = imgui.ImBool((mainIni.config.stats_armor == true ))
  108. local input_post_cd = imgui.ImInt((mainIni.config.input_post_cd and mainIni.config.input_post_cd or 900))
  109. window_post['status'] = imgui.ImBool(false)
  110. local window_binder = imgui.ImBool(false)
  111. local img_logo = imgui.CreateTextureFromFile(getGameDirectory() .. '\\moonloader\\image\\MO.png')
  112. --------------Функции----------------------------------------------
  113. function main()
  114.     while not isSampAvailable() do wait(100) end
  115.     autoupdate("No links", '['..string.upper(thisScript().name)..']: ', "No links")
  116.     sampRegisterChatCommand('moset', cmd_moset)
  117.     sampRegisterChatCommand('so', cmd_so)
  118.     sampRegisterChatCommand('post', cmd_post)
  119.     sampRegisterChatCommand('invite', cmd_invite)
  120.     sampRegisterChatCommand('uninvite', cmd_uninvite)
  121.     sampRegisterChatCommand('dis', cmd_dis)
  122.     sampRegisterChatCommand('fwarn', cmd_fwarn)
  123.     sampRegisterChatCommand('setskin', cmd_setskin)
  124.     sampRegisterChatCommand('rang', cmd_rang)
  125.     sampRegisterChatCommand('mobind', cmd_mobind)
  126.     sampRegisterChatCommand('division', cmd_division)
  127.     sampRegisterChatCommand('stoppost', cmd_stoppost)
  128.     sampRegisterChatCommand('around', cmd_around)
  129.     sampRegisterChatCommand('around2', cmd_around2)
  130.     sampRegisterChatCommand('ud', cmd_ud)
  131.     sampRegisterChatCommand('r', cmd_r)
  132.     sampRegisterChatCommand('f', cmd_f)
  133.     if stats_post.v then
  134.         render_posts()
  135.     end
  136.     _, my['id'] =  sampGetPlayerIdByCharHandle(PLAYER_PED)
  137.     my['name']  =  sampGetPlayerNickname(my['id'])
  138.     my['lastname'] = my['name']:match('.*_(.*)')
  139.     my['firstname'] = my['name']:match('(.*)_.*')
  140.     sampSendChat('/stats')
  141.     if bNotf then   notf.addNotification('ВМФ MONSTER загружен', 3, 1) end
  142.     file = io.open(getWorkingDirectory().."\\config\\VMF.json","r+")
  143.     if file == nil then
  144.         file = io.open(getWorkingDirectory().."\\config\\VMF.json","w")
  145.         file:write(encodeJson(binder))
  146.         file:flush()
  147.         file:close()
  148.         file = io.open(getWorkingDirectory().."\\config\\VMF.json","r+")
  149.     end
  150.     binder = decodeJson(file:read())
  151.     file:flush()
  152.     file:close()
  153.     updatebind()
  154.     lua_thread.create(function()
  155.     while true do wait(0)
  156.             local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
  157.             result, id = sampGetPlayerIdByCharHandle(ped)
  158.             if result and isKeyDown(VK_Z) then
  159.                 tab_id = id
  160.                 window_state_tab.v = isKeyDown(VK_Z)
  161.                 sampDestroy3dText(tlb)
  162.                 tlb=nil
  163.             elseif isKeyDown(VK_Z) == false and result == false then
  164.                 sampDestroy3dText(tlb)
  165.                 tlb=nil
  166.                 window_state_tab.v = isKeyDown(VK_Z)
  167.             end
  168.             if result and isKeyDown(VK_Z) == false and tlb == nil then tlb = sampCreate3dText('Зажми {00ff00}Z', '0xFFFFFFFF', 0, 0, 0.66, 30, true,id,-1) end
  169.         end
  170.     end)
  171.     while true do wait(0)
  172.         imgui.Process = true
  173.         if stats_head_rang.v and not check_my then
  174.             update_head()
  175.             wait(wait_head.v*1000)
  176.         end
  177.     end
  178. end
  179. function sampev.onShowDialog(id,style,title,button1,button2,text)
  180.     if title:find('Статистика') and check_my then
  181.         for line in text: gmatch("[^\n]+") do
  182.             if line:find('Должность:%s+%{0099ff%}(.*)') then
  183.                 my['rang'] = line:match('Должность:%s+%{0099ff%}(.*)')
  184.                 binder_tags =
  185.                 {
  186.                     myname =            {
  187.                                                     text     = 'Ваш игровой ник (РП)',
  188.                                                     input    = imgui.ImBuffer('myname',256),
  189.                                                     action = my['name']:gsub('_',' ')
  190.                                                 },
  191.                     myid =              {
  192.                                                     text     = 'Ваш игровой ID',
  193.                                                     input    = imgui.ImBuffer('myid',256),
  194.                                                     action = my['id']
  195.                                                 },
  196.                     myrang =        {
  197.                                                     text   ='Ваша должность',
  198.                                                     input  =imgui.ImBuffer('myrang',256),
  199.                                                     action = my['rang']
  200.                                                 },
  201.                     myfirstname = {
  202.                                                     text     = 'Ваше имя',
  203.                                                     input    = imgui.ImBuffer('myfirstname',256),
  204.                                                     action = my['firstname']
  205.                                                 },
  206.                     mylastname =  {
  207.                                                     text     ='Ваша фамилия',
  208.                                                     input  = imgui.ImBuffer('mylastname',256),
  209.                                                     action = my['lastname']
  210.                                                 }
  211.                 }
  212.                 print('Тэги и статистика загружены')
  213.             end
  214.         end
  215.         check_my = false
  216.         sampSendDialogResponse(id)
  217.         return false
  218.     elseif (title:find('Выберите предмет') and go_armor) then
  219.             sampSendDialogResponse(id,1,0)
  220.             go_armor = false
  221.             return false
  222.     elseif (title:find('Члены организации онлайн')) then
  223.     local i = 0
  224.     if check_find then
  225.         for line in text: gmatch("[^\n]+") do
  226.             if line:find('(%d+)%s+%d+%s+%d+%s+(%d+)%s+%[(.*)%]%s+%d+%/%d+%s+[-|%{FDFC83%}%d+ дней%{FFFFFF%}]+%s+([A-Za-z_]+)') then
  227.                 local id,rang,tag = line:match('(%d+)%s+%d+%s+%d+%s+(%d+)%s+%[(.*)%]%s+%d+%/%d+%s+[-|%{FDFC83%}%d+ дней%{FFFFFF%}]+%s+[A-Za-z_]+')
  228.                 local text_id = sampCreate3dText(rangs[tonumber(rang)]..' ['..tag..']', '0xFFFFFFFF', 0, 0, 0.36, 10, true,id,-1)
  229.                 table.insert(head_rang,text_id)
  230.                 i = i+1
  231.             end
  232.         end
  233.         table.insert(find_stats['online'],i)
  234.         sampSendDialogResponse(id)
  235.         return false
  236.     else
  237.         find = {}
  238.         local i = 0
  239.         for line in text: gmatch("[^\n]+") do
  240.             if line:find('(%d+)%s+%d+%s+%d+%s+(%d+)%s+%[(.*)%]%s+%d+%/%d+%s+[%{FDFC83%}В розыске%{FFFFFF%}|%-|%{FDFC83%}%d+ дней%{FFFFFF%}]+%s+([A-Za-z_]+)') then
  241.                 i = i+1
  242.                 setClipboardText(line)
  243.                 local id,lvl,number,rang,tag,warn,status,name,dop = line:match('(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+%[(.*)%]%s+(%d+%/%d+)%s+([%{FDFC83%}В розыске%{FFFFFF%}|%-|%{FDFC83%}%d+ дней%{FFFFFF%}]+)%s+([A-Za-z_]+)(.*)')
  244.                 local nearby = 'Нет'
  245.                 for k, v in pairs(getAllChars()) do
  246.                     local _, l_id = sampGetPlayerIdByCharHandle(v)
  247.                     if tonumber(id) == l_id then  nearby = 'Да' end
  248.                 end
  249.                 table.insert(find,{id,lvl,number,rang,tag,warn,status,name,nearby,dop:gsub('%{[A-Za-z%d+]+%}','')})
  250.             end
  251.         end
  252.         table.insert(find_stats['online'],i)
  253.         select_find = find[1]
  254.         find_window.v = true
  255.         sampSendDialogResponse(id)
  256.         return false
  257.     end
  258.     end
  259. end
  260. function sampev.onSendChat(msg)
  261.     msg = u8:decode(input_acent.v)..' '..msg
  262.     return {msg}
  263. end
  264. function sampev.onServerMessage(color,text)
  265.     print(color)
  266.     if text:find('Добро пожаловать на Diamond Role Play!') and check_my then
  267.     lua_thread.create(function()
  268.         sampSendChat('/stats')
  269.     end)
  270.     elseif text == '• {00CC00}[Успешно] {ffffff}Вы начали охрану базы' then
  271.         cmd_post('СО',true)
  272.     elseif text:find('%{00CC00%}%[Успешно%] %{ffffff%}Вы закончили охрану базы, ваш заработок') then
  273.         cmd_stoppost(true)
  274.     elseif text == '• {FFC800}[Подсказка] {ffffff}Для установки бронежилета используйте /ainv' then
  275.         if stats_armor.v then
  276.             go_armor = true
  277.             sampSendChat('/ainv')
  278.         end
  279.     elseif text:find('Всего Online') and check_find then check_find = false ;return false
  280.     elseif text=='{CECECE}Используйте {6699FF}/eating {CECECE}чтобы поесть' and stats_eat.v then sampSendChat('/eating')
  281.     end
  282. end
  283. function imgui.OnDrawFrame()
  284.     local iScreenWidth, iScreenHeight = getScreenResolution()
  285.     if moset_window.v or window_so.v or window_binder.v or find_window.v or windows_gnews.v then imgui.ShowCursor = true else imgui.ShowCursor = false end
  286.     if hud.v then
  287.         imgui.SetNextWindowPos(imgui.ImVec2(30, iScreenHeight /2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5,   0.5))
  288.         imgui.SetNextWindowSize(imgui.ImVec2(230, 130), imgui.Cond.FirstUseEver)
  289.         imgui.PushStyleColor(imgui.Col.WindowBg,imgui.ImVec4(0.06, 0.06, 0.06, 0.74))
  290.         imgui.Begin(u8'ВМФ МОНСТЕР',-1, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.NoResize)
  291.         imgui.CenterText(my['name'])
  292.         imgui.CenterText((my['rang'] and '['..u8:encode(my['rang'])..']' or u8'Загрузка...'))
  293.         imgui.Separator()
  294.         imgui.Columns(2)
  295.         imgui.SetColumnWidth(-1, 170)
  296.         imgui.Text(u8'Квадрат')
  297.         imgui.Text(u8'Пинг')
  298.         imgui.NextColumn()
  299.         imgui.Text(u8:encode(kvadrat()))
  300.         imgui.Separator()
  301.         imgui.Text(tostring(sampGetPlayerPing(my['id'])))
  302.         imgui.Columns(1)
  303.         imgui.Separator()
  304.         imgui.CenterText(os.date("%X",os.time()))
  305.         imgui.End()
  306.         imgui.PopStyleColor()
  307.     end
  308.     if window_post['status'].v then
  309.         imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth-130, iScreenHeight / 2.7), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5,  0.5))
  310.         imgui.SetNextWindowSize(imgui.ImVec2(170, 90), imgui.Cond.FirstUseEver)
  311.         imgui.Begin(window_post['title'],-1, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.NoResize)
  312.         imgui.Text(u8'Сделано докладов: '..window_post['doklade'])
  313.         imgui.Text(u8'След доклад: '..window_post['sec']..u8' сек.')
  314.         imgui.Separator()
  315.         if window_post['title']~='СО' then
  316.             imgui.Text(u8'Остановить: /stoppost')
  317.         end
  318.         imgui.End()
  319.     end
  320.     -----------------------------БИНДЕР------------------------------------
  321.     if window_binder.v then
  322.      imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth/2, iScreenHeight /2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5,  0.5))
  323.      imgui.SetNextWindowSize(imgui.ImVec2(500, 500), imgui.Cond.FirstUseEver)
  324.      imgui.Begin(u8'ВМФ МОНСТЕР | Binder',window_binder, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.NoResize)
  325.      imgui.Columns(2,nil,false)
  326.      imgui.SetColumnWidth(-1, 150)
  327.      if imgui.Selectable(u8'Биндеры',(binder_select==1)) then binder_select = 1
  328.      elseif imgui.Selectable(u8'Создать биндер',(binder_select==2)) then binder_select = 2 end
  329.      imgui.BeginChild('tags', imgui.ImVec2(140,435), true)
  330.      for key, val in pairs(binder_tags) do
  331.          imgui.Text(u8:encode(val['text']))
  332.          imgui.InputText('##'..val['text'],val['input'],imgui.InputTextFlags.ReadOnly)
  333.      end
  334.      imgui.EndChild()
  335.      imgui.NextColumn()
  336.      if binder_select==1 then
  337.          for key, val in pairs(binder['binders']) do
  338.              if imgui.Selectable(tostring(key),(select_bind==key)) then
  339.                  select_bind = key
  340.              end
  341.              imgui.SameLine()
  342.              imgui.CenterColumnText(tostring(val['name']))
  343.              if key == select_bind then
  344.                  imgui.NewLine();imgui.SameLine(70)
  345.                  imgui.BeginChild('createbind', imgui.ImVec2(220,70), true)
  346.                      imgui.Text(u8'Клавиша: '..  table.concat(rkeys.getKeysName( val['key'])))
  347.                      imgui.Text(u8'Межстроковая задержка: '..val['wait']..u8'мс.')
  348.                      if imgui.Button(u8'Редактировать', imgui.ImVec2(100,20)) then
  349.                          binder_create_wait = imgui.ImInt(val['wait'])
  350.                          binder_create_name = imgui.ImBuffer(val['name'],256)
  351.                          binder_create_key = {v={vkeys[val['key']]}}
  352.                          default_key = {v={vkeys[val['key']]}}
  353.                          binder_create_lines = {}
  354.                          for key, val in pairs(val['lines']) do
  355.                              table.insert(binder_create_lines,imgui.ImBuffer(u8:encode(val),256))
  356.                          end
  357.                          binder_select = 2
  358.                      end
  359.                      imgui.SameLine()
  360.                      if imgui.Button(u8'Удалить', imgui.ImVec2(100,20)) then
  361.                          for lkey, lval in pairs(binder['binders']) do
  362.                              if val['name']== lval['name'] then
  363.                                  rkeys.unRegisterHotKey(lval['id'])
  364.                                  table.remove(binder['binders'],lkey)
  365.                              end
  366.                          end
  367.                          os.remove(getWorkingDirectory().."\\config\\VMF.json")
  368.                          file = io.open(getWorkingDirectory().."\\config\\VMF.json","w")
  369.                          file:write(encodeJson(binder))
  370.                          file:flush()
  371.                          file:close()
  372.                          select_bind = 0
  373.                      end
  374.                  imgui.EndChild()
  375.              end
  376.          end
  377.      elseif binder_select==2 then
  378.      imgui.CenterColumnText(u8'Создание биндера')
  379.      imgui.Text(u8'Название бинда')
  380.      imgui.SameLine(220)
  381.      imgui.Text(u8'Клавиша')
  382.      imgui.PushItemWidth(190)
  383.      imgui.InputText('##1',binder_create_name)
  384.      imgui.SameLine()
  385.      imgui.HotKey("##active",default_key, binder_create_key, 100)
  386.      imgui.InputInt(u8'Задержка',binder_create_wait)
  387.      imgui.BeginChild('createbind', imgui.ImVec2(330,360), true)
  388.      for line_num, line in pairs(binder_create_lines) do
  389.          imgui.PushItemWidth(290)
  390.          imgui.InputText('##'..line_num,binder_create_lines[line_num])
  391.          imgui.SameLine()
  392.          if imgui.Button('X##'..line_num) then table.remove(binder_create_lines,line_num) end
  393.      end
  394.      imgui.EndChild()
  395.      if imgui.Button(u8'Еще строку') then
  396.          table.insert(binder_create_lines,imgui.ImBuffer(256))
  397.      end
  398.      imgui.SameLine()
  399.      if imgui.Button(u8'Сохранить') then
  400.         if #binder_create_name.v>0 then
  401.          local lines = {}
  402.          for key, val in pairs(binder['binders']) do
  403.              if val['name']== binder_create_name.v then
  404.                  rkeys.unRegisterHotKey(val['id'])
  405.                  table.remove(binder['binders'],key)
  406.              end
  407.          end
  408.          for line_num, line in pairs(binder_create_lines) do
  409.              table.insert(lines,u8:decode(binder_create_lines[line_num].v))
  410.          end
  411.          local key = table.concat(rkeys.getKeysName(binder_create_key.v))
  412.          table.insert(binder['binders'],
  413.          {
  414.              name = binder_create_name.v,
  415.              key = default_key.v,
  416.              wait = binder_create_wait.v,
  417.              lines = lines
  418.          })
  419.          os.remove(getWorkingDirectory().."\\config\\VMF.json")
  420.          file = io.open(getWorkingDirectory().."\\config\\VMF.json","w")
  421.          file:write(encodeJson(binder))
  422.          file:flush()
  423.          file:close()
  424.          binder_create_name = imgui.ImBuffer(256)
  425.          binder_create_key = {}
  426.          binder_create_wait = imgui.ImInt(1000)
  427.          binder_create_lines = {
  428.              imgui.ImBuffer(256),
  429.              imgui.ImBuffer(256),
  430.              imgui.ImBuffer(256)
  431.          }
  432.          updatebind()
  433.          if bNotf then  notf.addNotification('Бинд зарегистрирован', 3, 2) end
  434.       else
  435.             if bNotf then   notf.addNotification('Вы забыли указать название бинда', 3, 1) end
  436.         end
  437.      end
  438.      end
  439.      imgui.Columns(1)
  440.      imgui.End()
  441.     end
  442.     -----------------------------------------------------------------------
  443.     if window_so.v then
  444.         imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth/2, iScreenHeight/2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5,    0.5))
  445.         imgui.SetNextWindowSize(imgui.ImVec2(580, 200), imgui.Cond.FirstUseEver)
  446.         imgui.Begin(u8'Доклады СНБ',window_so, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoResize)
  447.         imgui.Columns(2,nil,false)
  448.         imgui.Text(u8'Доставка БП')
  449.         if imgui.Button(u8'Выехал на СО',imgui.ImVec2(281, 30)) then
  450.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает: '..my['rang']..' '..my['lastname']..' | Выехал на СО.')
  451.             if stats_screen.v then takescreen() end
  452.         elseif imgui.Button(u8'Прибыл на СО',imgui.ImVec2(281, 30)) then
  453.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает: '..my['rang']..' '..my['lastname']..' | Прибыл на СО, начинаю загрузку боеприпасов.')
  454.             if stats_screen.v then takescreen() end
  455.         elseif imgui.Button(u8'Выехал на базу',imgui.ImVec2(281, 30)) then
  456.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..' | Загрузил боеприпасы, выезжаю на базу.')
  457.             if stats_screen.v then takescreen() end
  458.         elseif imgui.Button(u8'Прибыл на базу',imgui.ImVec2(281, 30)) then
  459.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..' | Прибыл на базу, начинаю разгрузку боеприпасов.')
  460.             if stats_screen.v then takescreen() end
  461.         end
  462.         imgui.NextColumn()
  463.         imgui.Text(u8'Сопровождение')
  464.         if imgui.Button(u8'Выехали на СО',imgui.ImVec2(281, 30)) then
  465.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает: '..my['rang']..' '..my['lastname']..' | Выехали с базы на Склад Оружия | Сопровождаю фуру')
  466.             if stats_screen.v then takescreen() end
  467.         elseif imgui.Button(u8'Прибыли на СО',imgui.ImVec2(281, 30)) then
  468.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..' | Прибыли на Склад Оружия | Сопровождаю фуру')
  469.             if stats_screen.v then takescreen() end
  470.         elseif imgui.Button(u8'Выехали на базу',imgui.ImVec2(281, 30)) then
  471.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..' | Загрузились на Складе Оружия | Сопровождаю фуру')
  472.             if stats_screen.v then takescreen() end
  473.         elseif imgui.Button(u8'Прибыли на базу',imgui.ImVec2(281, 30)) then
  474.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..' | Прибыли на базу | Сопровождаю фуру')
  475.             if stats_screen.v then takescreen() end
  476.         end
  477.         imgui.Columns(1,nil,false)
  478.         imgui.End() -- CНБ
  479.     end
  480.     if (window_state_tab.v) then
  481.         imgui.ShowCursor = true
  482.         imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth/2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5,  0.5))
  483.         imgui.OpenPopup('PieMenu')
  484.         if pie.BeginPiePopup('PieMenu', 0) then
  485.             if pie.PieMenuItem(u8 'Удостоверение') then cmd_ud(tab_id) end
  486.             if pie.PieMenuItem(u8 'Приветствие') then cmd_hello(tab_id) end
  487.             if pie.PieMenuItem(u8 'Покиньте территорию!') then cmd_terr(tab_id) end
  488.         end
  489.         pie.EndPiePopup() -- PIE
  490.     end
  491.     if find_window.v then
  492.         imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth/2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5,  0.5))
  493.         imgui.SetNextWindowSize(imgui.ImVec2(880, 495), imgui.Cond.FirstUseEver)
  494.         imgui.Begin(u8"Члены организации онлайн",find_window, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoResize)
  495.         imgui.Columns(2,nil,false)
  496.         imgui.SetColumnWidth(-1, 680)
  497.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'[ID]')
  498.         imgui.SameLine(60.0)
  499.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'Ник')
  500.         imgui.SameLine(180.0)
  501.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'Взвод')
  502.         imgui.SameLine(240.0)
  503.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'Ранг')
  504.         imgui.SameLine(300.0)
  505.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'Выговоры')
  506.         imgui.SameLine(400.0)
  507.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'Статус')
  508.         imgui.SameLine(470.0)
  509.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'Рядом')
  510.         imgui.SameLine(530.0)
  511.         imgui.TextColored(imgui.ImColor(255.0, 255.0, 255.0, 255.0):GetVec4(),u8'VOICE\\AFK')
  512.         imgui.BeginChild('find', imgui.ImVec2(670,380), true)
  513.         for i = 1,table.maxn(find) do
  514.          if find_stats[find[i][5]].v then
  515.             if imgui.Selectable(u8:encode(find[i][1]),(find[i][1] == select_find[1])) then select_find = find[i] end
  516.             imgui.SameLine(50.0)
  517.             imgui.Text(u8:encode(find[i][8]))
  518.             imgui.SameLine(180.0)
  519.             imgui.Text(u8:encode(find[i][5]))
  520.             imgui.SameLine(240.0)
  521.             imgui.Text(u8:encode(find[i][4]))
  522.             imgui.SameLine(300.0)
  523.             imgui.Text(u8:encode(find[i][6]))
  524.             imgui.SameLine(400.0)
  525.             imgui.CenterTextColoredRGB(find[i][7])
  526.             imgui.SameLine(470.0)
  527.             imgui.Text(u8:encode(find[i][9]))
  528.             imgui.SameLine(520.0)
  529.             imgui.Text(find[i][10])
  530.         end
  531.         end
  532.         imgui.EndChild()
  533.         imgui.Text(u8'Онлайн организации: '..find_stats['online'][#find_stats['online']])
  534.         imgui.SameLine()
  535.         imgui.Text(u8'Общий онлайн: '..sampGetPlayerCount(false))
  536.         imgui.BeginChild('dd', imgui.ImVec2(310,40), true)
  537.         imgui.Checkbox(u8'ВВО',find_stats['ВВО'])
  538.         imgui.SameLine()
  539.         imgui.Checkbox(u8'Штаб',find_stats['Штаб'])
  540.         imgui.SameLine()
  541.         imgui.Checkbox(u8'СНБ',find_stats['СНБ'])
  542.         imgui.SameLine()
  543.         imgui.Checkbox(u8'БО',find_stats['БО'])
  544.         imgui.SameLine()
  545.         imgui.Checkbox(u8'СНБ',find_stats['СНБ'])
  546.         imgui.SameLine()
  547.         imgui.Checkbox(u8'НБ',find_stats['НБ'])
  548.         imgui.EndChild()
  549.         imgui.SameLine()
  550.         imgui.PushStyleColor(imgui.Col.Text,imgui.ImVec4(1.00, 1.00, 1.00, 0.40))
  551.             imgui.PlotLines('##1',find_stats['online'], 0,u8'Мониторинг финда', 0, 40,imgui.ImVec2(360, 40))
  552.         imgui.PopStyleColor()
  553.         imgui.NextColumn()
  554.         imgui.SetCursorPos(imgui.ImVec2(705, 35))
  555.         imgui.Image(img_logo, imgui.ImVec2(140, 140))
  556.         imgui.CenterColumnText(select_find[8])
  557.         imgui.CenterColumnText(u8:encode(rangs[tonumber(select_find[4])]))
  558.         if imgui.Button(u8'Копировать ник',imgui.ImVec2(180, 20)) then setClipboardText(select_find[8]:gsub('_',' '));if bNotf then    notf.addNotification('Ник скопирован в буфер обмена', 3, 2) end end
  559.         if imgui.Button(u8'Копировать тлф',imgui.ImVec2(180, 20))  then setClipboardText(select_find[3]);if bNotf then notf.addNotification('Телефон скопирован в буфер обмена', 3, 2) end end
  560.         if imgui.Button(u8'Запросить местоположение',imgui.ImVec2(180, 20))  then
  561.             sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' '..rangs[tonumber(select_find[4])]..' '..select_find[8]:gsub('_',' ')..', сообщите Ваше местоположение!')
  562.         end
  563.         imgui.Columns(1,nil,false)
  564.         imgui.End() -- Финд
  565.     end
  566.     if moset_window.v then
  567.         imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth/2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5,  0.5))
  568.         imgui.SetNextWindowSize(imgui.ImVec2(700, 470), imgui.Cond.FirstUseEver)
  569.         imgui.Begin(u8"ВМФ Monster ["..thisScript().version.."]",moset_window, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoResize)
  570.         local draw_list = imgui.GetWindowDrawList();
  571.         local p = imgui.GetCursorScreenPos();
  572.         draw_list:AddRectFilled(imgui.ImVec2(0,0), imgui.ImVec2(p.x+imgui.GetWindowSize().x/1.45    ,p.y+imgui.GetWindowSize().y), 0xFF0E0E0E)
  573.         imgui.SetCursorPos(imgui.ImVec2(0, 30))
  574.         imgui.Columns(2,nil,false)
  575.         imgui.SetColumnWidth(-1, imgui.GetWindowSize().x/1.4)
  576.         if imgui.InputText(u8'Тэг в /f',input_prefix_f) then mainIni.config.prefix_f = input_prefix_f.v inicfg.save(mainIni, directIni)
  577.         elseif imgui.InputText(u8'Тэг в /r',input_prefix_r)  then mainIni.config.prefix_r = input_prefix_r.v inicfg.save(mainIni, directIni)
  578.         elseif imgui.InputText(u8'Акцент в обычный чат',input_acent)  then mainIni.config.acent = input_acent.v inicfg.save(mainIni, directIni)
  579.         elseif imgui.InputInt(u8'КД на постах (сек.)',input_post_cd)  then mainIni.config.input_post_cd = input_post_cd.v inicfg.save(mainIni, directIni)
  580.         end
  581.         imgui.PushItemWidth(130)
  582.         if imgui.ListBox('##2', sex,{u8'Парень',u8'Девушка'}, 2) then mainIni.config.sex = sex.v inicfg.save(mainIni, directIni)    end
  583.         imgui.NextColumn()
  584.         imgui.NewLine();imgui.SameLine(30)
  585.         imgui.Image(img_logo, imgui.ImVec2(140, 140))
  586.         imgui.NewLine()
  587.         imgui.CenterColumnText(u8:encode(my['name']))
  588.         imgui.CenterColumnText(u8:encode(my['rang']))
  589.         imgui.NewLine()
  590.         if imgui.Checkbox(u8'Подсветка постов',stats_post) then  mainIni.config.stats_post = stats_post.v inicfg.save(mainIni, directIni)
  591.             if not stats_post.v then
  592.                     for i = 1, #posts do
  593.                         sampDestroy3dText(posts[i])
  594.                     end
  595.                     posts = {}
  596.                 else
  597.                     render_posts()
  598.             end
  599.         end
  600.         if imgui.Checkbox(u8'Звания над головой',stats_head_rang) then  mainIni.config.stats_head_rang = stats_head_rang.v inicfg.save(mainIni, directIni)
  601.             if not stats_head_rang.v then
  602.                 for i = 1, #head_rang do
  603.                     sampDestroy3dText(head_rang[i])
  604.                 end
  605.                 head_rang = {}
  606.             else
  607.                 check_find = true
  608.                 sampSendChat('/find')
  609.             end
  610.         end
  611.         if stats_head_rang.v then
  612.             if imgui.InputInt(u8'КД (Сек)',wait_head) then mainIni.config.wait_head = wait_head.v inicfg.save(mainIni, directIni) end
  613.         end
  614.         if imgui.Checkbox(u8'Автоматический /eating',stats_eat) then  mainIni.config.stats_eat = stats_eat.v inicfg.save(mainIni, directIni) end
  615.         if imgui.Checkbox(u8'Авто-бронь',stats_armor) then  mainIni.config.stats_armor = stats_armor.v inicfg.save(mainIni, directIni) end
  616.         if imgui.Checkbox(u8'/time+F8 при отчётах',stats_screen) then  mainIni.config.stats_screen = stats_screen.v inicfg.save(mainIni, directIni) end
  617.         if imgui.Checkbox(u8'Худ',hud) then  mainIni.config.hud = hud.v inicfg.save(mainIni, directIni) end
  618.         imgui.End() -- Основные настройки
  619.     end
  620. end
  621. function cmd_around2()
  622. lua_thread.create(function()
  623.     sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Начал'..(sex.v and '' or 'а')..' водный патруль.')
  624.     if stats_screen.v then takescreen() end
  625.     wait(300)
  626.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Вы начали водный патруль. Двигайтесь по чекпоинтам', -1)
  627.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Для удобства, на карте выставлены белые точки', -1)
  628.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь к ВМФ', -1)
  629.     setMarker(0, -1463, 550, 0, 10, 0xFFFFFFFF)
  630.     sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Веду патрулирование | База Военно-Морского Флота | Состояние: C\'1.')
  631.     if stats_screen.v then takescreen() end
  632.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь на залив', -1)
  633.     setMarker(0, -284, -478, 0, 10, 0xFFFFFFFF)
  634.     sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Веду патрулирование | Залив | Состояние: C\'1.')
  635.     if stats_screen.v then takescreen() end
  636.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь к маяку', -1)
  637.     setMarker(0, 66, -1804, 0, 10, 0xFFFFFFFF)
  638.     sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Веду патрулирование | Маяк | Состояние: C\1.')
  639.     if stats_screen.v then takescreen() end
  640.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь на авианосец', -1)
  641.     setMarker(0, 647, -2990,0, 10, 0xFFFFFFFF)
  642.     sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Веду патрулирование | Авианосец | Состояние: C\1.')
  643.     if stats_screen.v then takescreen() end
  644.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь на Склад Оружия', -1)
  645.     setMarker(0, 2047,-100,0, 10, 0xFFFFFFFF)
  646.     sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Веду патрулирование | Склад Оружия . | Состояние: C\'1.')
  647.     sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Завершил водный патруль.')
  648.     if stats_screen.v then takescreen() end
  649. end)
  650. end
  651. function cmd_around()
  652. lua_thread.create(function()
  653.     sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Начал'..(sex.v and '' or 'а')..' обход территории ВМФ.')
  654.     if stats_screen.v then takescreen() end
  655.     wait(300)
  656.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Вы начали обход территории ВМФ. Двигайтесь по чекпоинтам', -1)
  657.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Для удобства, на карте выставлены белые точки', -1)
  658.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь к казарме', -1)
  659.     setMarker(0, -1677, 296, 7, 10, 0xFFFFFFFF)
  660.     sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Провожу обход базы | Пост: Казарма | Состояние: стабильно.')
  661.     if stats_screen.v then takescreen() end
  662.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь на главный склад', -1)
  663.     setMarker(0, -1529, 375, 14, 10, 0xFFFFFFFF)
  664.     sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Провожу обход базы | Пост: Главный Склад | Состояние: стабильно .')
  665.     if stats_screen.v then takescreen() end
  666.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь на КПП', -1)
  667.     setMarker(0, -1529, 477, 7, 10, 0xFFFFFFFF)
  668.     sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Провожу обход базы | Пост: КПП | Состояние: стабильно .')
  669.     if stats_screen.v then takescreen() end
  670.     sampAddChatMessage('{00ff00}[Обход]{ffffff} - Двигайтесь на авианосец', -1)
  671.     setMarker(0, -1333, 467, 7, 10, 0xFFFFFFFF)
  672.     sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Провожу обход базы | Пост: Авианосец| Состояние: стабильно .')
  673.     sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Закончил'..(sex.v and '' or 'а')..' обход территории ВМФ.')
  674.     if stats_screen.v then takescreen() end
  675. end)
  676. end
  677. function cmd_stoppost(global)
  678.     window_post['status'].v = false
  679.     if #global>0 then
  680.         sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Закончил'..(sex.v and '' or 'а')..' охрану поста: '..u8:decode(window_post['title']))
  681.     else
  682.                 sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Закончил'..(sex.v and '' or 'а')..' охрану поста: '..u8:decode(window_post['title']))
  683.     end
  684.     if stats_screen.v then takescreen() end
  685. end
  686. function cmd_post(post,global)
  687.     if #post ~= 0 then
  688.         window_post['title'] = u8:encode(post)
  689.         window_post['doklade'] = 1
  690.         window_post['status'].v = true
  691.         lua_thread.create(function()
  692.             if global then
  693.                 sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Заступил'..(sex.v and '' or 'а')..' на пост: '..post..'. Состояние: стабильное')
  694.             else
  695.                 sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Заступил'..(sex.v and '' or 'а')..' на пост: '..post..'. Состояние: стабильное')
  696.             end
  697.             if stats_screen.v then takescreen() end
  698.             while window_post['status'].v do
  699.                 for i = 0, input_post_cd.v do
  700.                     window_post['sec'] = input_post_cd.v-i
  701.                     wait(1000)
  702.                 end
  703.                 if window_post['status'].v then
  704.                     if global then
  705.                         sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Пост: '..post..'. Состояние: стабильное')
  706.                     else
  707.                         sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' Докладывает '..my['rang']..' '..my['lastname']..'. Пост: '..post..'. Состояние: стабильное')
  708.                     end
  709.                     if stats_screen.v then takescreen() end
  710.                     window_post['doklade'] = window_post['doklade']+1
  711.                 end
  712.             end
  713.         end)
  714.     else
  715.         sampAddChatMessage('/post <Пост>', -1)
  716.     end
  717. end
  718. function cmd_invite(id)
  719.  lua_thread.create(function()
  720.     if id:find('%d+') then
  721.         sampSendChat('/do В левой руке офицера кейс. ')
  722.         wait(2000)
  723.         sampSendChat('/me быстрым движением руки открыл кейс, затем достал оттуда пакет формы, погоны и шевроны. ')
  724.         wait(2000)
  725.         sampSendChat('/me достал из кейса рацию, после чего протянул все вещи человеку напротив. ')
  726.         wait(1000)
  727.         sampSendChat('/invite '..id)
  728.     else
  729.         sampSendChat('/invite')
  730.     end
  731.  end)
  732. end
  733. function cmd_division(id)
  734.  lua_thread.create(function()
  735.     if id:find('%d+') then
  736.         sampSendChat('/do В кармане кителя офицера лежит смартфон.')
  737.         wait(2000)
  738.         sampSendChat('/me быстрым движением руки достал смартфон, разблокировал его, после чего запустил базу данных ВМФ')
  739.         wait(2000)
  740.         sampSendChat('/me нашел в списке состава нужного бойца, изменил ему взвод, затем заблокировал смартфон и положил его обратно в карман.')
  741.         wait(1000)
  742.         sampSendChat('/division '..id)
  743.     else
  744.         sampSendChat('/division')
  745.     end
  746.  end)
  747. end
  748. function cmd_uninvite(id)
  749.  lua_thread.create(function()
  750.     if #id>0 then
  751.         sampSendChat('/do В кармане кителя офицера лежит смартфон.')
  752.         wait(2000)
  753.         sampSendChat('/me быстрым движением руки достал смартфон, разблокировал его, после чего запустил базу данных Военно-морского флота')
  754.         wait(2000)
  755.         sampSendChat('/me нашел в списке состава нужного бойца, нажал на кнопку «Увольнение», затем заблокировал смартфон и положил его обратно в карман.')
  756.         wait(1000)
  757.         sampSendChat('/uninvite '..id)
  758.     else
  759.         sampSendChat('/uninvite')
  760.     end
  761.  end)
  762. end
  763. function gnews(text)
  764.     if #text>0 then
  765.         windows_gnews.v = not windows_gnews.v
  766.     else
  767.         sampSendChat('/gnews '..text)
  768.     end
  769. end
  770. function cmd_fwarn(id)
  771.  lua_thread.create(function()
  772.     if #id>0 then
  773.         sampSendChat('/do В кармане кителя офицера лежит смартфон.')
  774.         wait(2000)
  775.         sampSendChat('/me быстрым движением руки достал смартфон, разблокировал его, после чего запустил базу данных ВМФ')
  776.         wait(2000)
  777.         sampSendChat('/me нашел в списке состава нужного бойца, нажал на кнопку «Выговор», затем заблокировал смартфон и положил его обратно в карман.')
  778.         wait(1000)
  779.         sampSendChat('/fwarn '..id)
  780.     else
  781.         sampSendChat('/fwarn')
  782.     end
  783.  end)
  784. end
  785. function cmd_dis(id)
  786.  lua_thread.create(function()
  787.     if #id>0 then
  788.         sampSendChat('/do В кармане кителя офицера лежит смартфон.')
  789.         wait(2000)
  790.         sampSendChat('/me быстрым движением руки достал смартфон, разблокировал его, после чего запустил базу данных ВМФ')
  791.         wait(2000)
  792.         sampSendChat('/me нашел в списке состава нужного бойца, нажал на кнопку «Выговор», затем заблокировал смартфон и положил его обратно в карман.')
  793.         wait(2000)
  794.         sampSendChat('/me достал с кейса чистый бланк увольнительного билета и ручку, приступил к заполнению билета.')
  795.         wait(2000)
  796.         sampSendChat('/do Увольнительный билет оформлен на военнослужащего и утвержден командованием. ')
  797.         wait(2000)
  798.         sampSendChat('/me протянул увольнительный билет человеку напротив, спрятал ручку обратно в кейс.')
  799.         wait(1000)
  800.         sampSendChat('/dis '..id)
  801.     else
  802.         sampSendChat('/dis')
  803.     end
  804.  end)
  805. end
  806. function cmd_rang(id)
  807.  lua_thread.create(function()
  808.     if id:find('%d+') then
  809.         sampSendChat('/do В левой руке офицера кейс.')
  810.         wait(2000)
  811.         sampSendChat('/me быстрым движением руки открыл кейс, затем достал оттуда новые погоны и шевроны.')
  812.         wait(2000)
  813.         sampSendChat('/me протянул новые погоны и шевроны военнослужащему напротив, закрыл кейс. ')
  814.         wait(1000)
  815.         sampSendChat('/rang '..id)
  816.     else
  817.         sampSendChat('/rang')
  818.     end
  819.  end)
  820. end
  821. function cmd_setskin(id)
  822.  lua_thread.create(function()
  823.     if id:find('%d+') then
  824.         sampSendChat('/do В левой руке офицера кейс.')
  825.         wait(2000)
  826.         sampSendChat('/me быстрым движением руки открыл кейс, затем достал оттуда пакет формы и шевроны.')
  827.         wait(2000)
  828.         sampSendChat('/me протянул пакет формы и шевроны военнослужащему напротив, закрыл кейс.')
  829.         wait(1000)
  830.         sampSendChat('/setskin '..id)
  831.     else
  832.         sampSendChat('/setskin')
  833.     end
  834.  end)
  835. end
  836. function cmd_so()
  837.         window_so.v = not window_so.v
  838. end
  839. function cmd_moset()
  840.     moset_window.v = not moset_window.v
  841. end
  842. function cmd_r(text)
  843.     if #text ~= 0 then
  844.         sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' '..text)
  845.     else
  846.         sampAddChatMessage('/r (Текст)', -1)
  847.     end
  848. end
  849. function cmd_mobind()
  850.     window_binder.v = not window_binder.v
  851. end
  852. function cmd_f(text)
  853.     if #text ~= 0 then
  854.         sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' '..text)
  855.     else
  856.         sampAddChatMessage('/f (Текст)', -1)
  857.     end
  858. end
  859. function cmd_terr(id)
  860.     lua_thread.create(function()
  861.         local name = sampGetPlayerNickname(id):gsub('_',' ')
  862.         sampSendChat('/todo Немедленно покиньте территорию!*посмотрев на '..name..'.')
  863.     end)
  864. end
  865. function takescreen()
  866.     lua_thread.create(function()
  867.         sampSendChat('/time')
  868.         wait(300)
  869.         memory.setuint8( sampGetBase() + 0x119CBC, 1 )
  870.     end)
  871. end
  872. function cmd_hello(id)
  873.     lua_thread.create(function()
  874.         local name = sampGetPlayerNickname(id):gsub('_',' ')
  875.         sampSendChat('/todo Здравия желаю!*посмотрев на '..name..'.')
  876.     end)
  877. end
  878. function updatebind()
  879.     for key, val in pairs(binder['binders']) do
  880.         if binder['binders'][key]['id'] then
  881.             rkeys.unRegisterHotKey(binder['binders'][key]['id'])
  882.         end
  883.         binder['binders'][key]['id'] = rkeys.registerHotKey(val['key'], true, function ()
  884.             lua_thread.create(function()
  885.                 for num_line, line in pairs(val['lines']) do
  886.                     for tag, val_tag in pairs(binder_tags) do
  887.                         if line:find (tostring(val_tag['input'].v)) then
  888.                          line = line:gsub(tostring(val_tag['input'].v),val_tag['action']) end
  889.                     end
  890.                     if line:find('^%/f') then
  891.                         sampSendChat('/f '..u8:decode((input_prefix_f.v and input_prefix_f.v or ''))..' '..line:gsub('%/f',''))
  892.                     elseif line:find('^%/r') then
  893.                         sampSendChat('/r '..u8:decode((input_prefix_r.v and input_prefix_r.v or ''))..' '..line:gsub('%/r',''))
  894.                     else
  895.                         sampSendChat(line)
  896.                     end
  897.                         wait(val['wait'])
  898.                 end
  899.             end) -- поток
  900.         end) -- функция
  901.     end
  902. end
  903. function cmd_ud(id)
  904.     print(id)
  905. if (id>=0 and id <1000) then
  906.     lua_thread.create(function()
  907.         sampSendChat('/me чуть распахнув грудь, вытащил'..(sex.v and '' or 'а')..' удостоверение')
  908.         wait(2000)
  909.         sampSendChat('/todo '..my['rang']..' '..my['lastname']..'*раскрыв удостоверение перед лицом человека напротив.')
  910.         wait(2000)
  911.         sampSendChat('/ud '..id)
  912.     end)
  913. else
  914.     sampSendChat('/ud')
  915. end
  916. end
  917. function render_posts()
  918.     table.insert(posts,sampCreate3dText('Пост: КПП2\nИспользуйте {00ff00}/post КПП2{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1624, 270, 7, 7, false,-1,-1))
  919.     table.insert(posts,sampCreate3dText('Пост: КПП1\nИспользуйте {00ff00}/post КПП1{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1534, 479, 7, 7, false,-1,-1))
  920.     table.insert(posts,sampCreate3dText('Пост: Вышка1\nИспользуйте {00ff00}/post Вышка1{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1542, 477, 23, 7, false,-1,-1))
  921.     table.insert(posts,sampCreate3dText('Пост: Вышка2\nИспользуйте {00ff00}/post Вышка2{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1657, 337, 23, 7, false,-1,-1))
  922.     table.insert(posts,sampCreate3dText('Пост: Вышка3\nИспользуйте {00ff00}/post Вышка3{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1715, 272, 23, 7, false,-1,-1))
  923.     table.insert(posts,sampCreate3dText('Пост: Вышка4\nИспользуйте {00ff00}/post Вышка4{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1656, 270, 23, 7, false,-1,-1))
  924.     table.insert(posts,sampCreate3dText('Пост: ГС-2\nИспользуйте {00ff00}/post ГС-2{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1585, 392, 8, 7, false,-1,-1))
  925.     table.insert(posts,sampCreate3dText('Пост: ГС-1\nИспользуйте {00ff00}/post ГС-1{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1576, 392, 8, 7, false,-1,-1))
  926.     table.insert(posts,sampCreate3dText('Пост: ГС-2\nИспользуйте {00ff00}/post ГС-2{ffffff}, чтобы заступить на пост', 0xFFFFFFFF, -1543, 376, 11, 7, false,-1,-1))
  927.     table.insert(posts,sampCreate3dText('Строй младшего состава', 0xFFFFFFFF, -1665, 297, 6.3, 8, false,-1,-1))
  928.     table.insert(posts,sampCreate3dText('Строй офицерского состава', 0xFFFFFFFF, -1665, 302, 6.3, 8, false,-1,-1))
  929.     table.insert(posts,sampCreate3dText('При доставке БП, необходимо делать отчеты\nВведите {00ff00}/so{ffffff},чтобы открыть меню', 0xFFFFFFFF, -1560, 403, 7.5, 8, false,-1,-1))
  930.     table.insert(posts,sampCreate3dText('{8B4513}ВМФ МОНСТЕР (Freak Osborn)\n{8B4513}/moset - {ffffff} настройки\n{8B4513}/so - {ffffff}отчеты СНБ\n{8B4513}/post{ffffff} - запуск пост-информатора\n{8B4513}/around{ffffff} - обход базы\n{8B4513}/around2{ffffff} - патруль ВМФ\n{8B4513}/mobind{ffffff} - биндер', 0xFFFFFFFF, -1678, 310, 7, 20, false,-1,-1))
  931. end
  932. function onWindowMessage(msg, wparam, lparam)
  933.     if(msg == 0x100) then
  934.         if(wparam == VK_ESCAPE and (moset_window.v or window_binder.v or find_window.v or window_so.v)) then
  935.             moset_window.v = false
  936.             window_so.v = false
  937.             find_window.v = false
  938.             window_binder.v = false
  939.             consumeWindowMessage()
  940.         end
  941.     end
  942. end
  943. function update_head()
  944.             if stats_head_rang.v then
  945.                 if #head_rang > 0 then
  946.                     for i = 1, #head_rang do
  947.                         sampDestroy3dText(head_rang[i])
  948.                     end
  949.                     head_rang = {}
  950.                 end
  951.                 check_find = true
  952.                 sampSendChat('/find')
  953.  
  954.             end
  955. end
  956. function apply_custom_style()
  957.     imgui.SwitchContext()
  958.     local style = imgui.GetStyle()
  959.     local colors = style.Colors
  960.     local clr = imgui.Col
  961.     local ImVec4 = imgui.ImVec4
  962.  
  963.     style.WindowRounding = 6.0
  964.     style.WindowTitleAlign = imgui.ImVec2(0.5, 0.54)
  965.     style.ChildWindowRounding = 2.0
  966.     style.FrameRounding = 2.0
  967.     style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
  968.     style.ScrollbarSize = 13.0
  969.     style.ScrollbarRounding = 0
  970.     style.GrabMinSize = 8.0
  971.     style.GrabRounding = 1.0
  972.  
  973.     colors[clr.FrameBg]                = ImVec4(0.48, 0.23, 0.16, 0.54)
  974.     colors[clr.FrameBgHovered]         = ImVec4(0.98, 0.43, 0.26, 0.40)
  975.     colors[clr.FrameBgActive]          = ImVec4(0.98, 0.43, 0.26, 0.67)
  976.     colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
  977.     colors[clr.TitleBgActive]          = ImVec4(0.48, 0.23, 0.16, 1.00)
  978.     colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
  979.     colors[clr.CheckMark]              = ImVec4(0.98, 0.43, 0.26, 1.00)
  980.     colors[clr.SliderGrab]             = ImVec4(0.88, 0.39, 0.24, 1.00)
  981.     colors[clr.SliderGrabActive]       = ImVec4(0.98, 0.43, 0.26, 1.00)
  982.     colors[clr.Button]                 = ImVec4(0.48, 0.23, 0.16, 0.54)
  983.     colors[clr.ButtonHovered]          = ImVec4(0.98, 0.43, 0.26, 0.70)
  984.     colors[clr.ButtonActive]           = ImVec4(0.98, 0.28, 0.06, 1.00)
  985.     colors[clr.Header]                 = ImVec4(0.98, 0.43, 0.26, 0.31)
  986.     colors[clr.HeaderHovered]          = ImVec4(0.98, 0.43, 0.26, 0.80)
  987.     colors[clr.HeaderActive]           = ImVec4(0.98, 0.43, 0.26, 1.00)
  988.     colors[clr.Separator]              = ImVec4(0.61, 0.61, 0.61, 1.00)
  989.     colors[clr.SeparatorHovered]       = ImVec4(0.75, 0.25, 0.10, 0.78)
  990.     colors[clr.SeparatorActive]        = ImVec4(0.75, 0.25, 0.10, 1.00)
  991.     colors[clr.ResizeGrip]             = ImVec4(0.98, 0.43, 0.26, 0.25)
  992.     colors[clr.ResizeGripHovered]      = ImVec4(0.98, 0.43, 0.26, 0.67)
  993.     colors[clr.ResizeGripActive]       = ImVec4(0.98, 0.43, 0.26, 0.95)
  994.     colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00)
  995.     colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.50, 0.35, 0.40)
  996.     colors[clr.TextSelectedBg]         = ImVec4(0.98, 0.43, 0.26, 0.35)
  997.     colors[clr.Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00)
  998.     colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00)
  999.     colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 0.94)
  1000.     colors[clr.ChildWindowBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
  1001.     colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
  1002.     colors[clr.ComboBg]                = colors[clr.PopupBg]
  1003.     colors[clr.Border]                 = ImVec4(0.61, 0.61, 0.61, 0.70)
  1004.     colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)
  1005.     colors[clr.MenuBarBg]              = ImVec4(0.14, 0.14, 0.14, 1.00)
  1006.     colors[clr.ScrollbarBg]            = ImVec4(0.02, 0.02, 0.02, 0.53)
  1007.     colors[clr.ScrollbarGrab]          = ImVec4(0.31, 0.31, 0.31, 1.00)
  1008.     colors[clr.ScrollbarGrabHovered]   = ImVec4(0.41, 0.41, 0.41, 1.00)
  1009.     colors[clr.ScrollbarGrabActive]    = ImVec4(0.51, 0.51, 0.51, 1.00)
  1010.     colors[clr.CloseButton]            = ImVec4(0.41, 0.41, 0.41, 0.50)
  1011.     colors[clr.CloseButtonHovered]     = ImVec4(0.98, 0.39, 0.36, 1.00)
  1012.     colors[clr.CloseButtonActive]      = ImVec4(0.98, 0.39, 0.36, 1.00)
  1013.     colors[clr.PlotHistogram]          = ImVec4(0.90, 0.70, 0.00, 1.00)
  1014.     colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 0.60, 0.00, 1.00)
  1015.     colors[clr.ModalWindowDarkening]   = ImVec4(0.80, 0.80, 0.80, 0.35)
  1016. end
  1017. apply_custom_style()
  1018. function imgui.CenterColumnText(text)
  1019.     imgui.SetCursorPosX((imgui.GetColumnOffset() + (imgui.GetColumnWidth() / 2)) - imgui.CalcTextSize(text).x / 2)
  1020.     imgui.Text(text)
  1021. end
  1022. function imgui.CenterText(text)
  1023.     imgui.SetCursorPosX((imgui.GetWindowSize().x/2) - (imgui.CalcTextSize(text).x / 2))
  1024.     imgui.Text(text)
  1025. end
  1026. function autoupdate(json_url, prefix, url)
  1027.   local dlstatus = require('moonloader').download_status
  1028.   local json = getWorkingDirectory() .. '\\'..thisScript().name..'-version.json'
  1029.   if doesFileExist(json) then os.remove(json) end
  1030.   downloadUrlToFile(json_url, json,
  1031.     function(id, status, p1, p2)
  1032.       if status == dlstatus.STATUSEX_ENDDOWNLOAD then
  1033.         if doesFileExist(json) then
  1034.           local f = io.open(json, 'r')
  1035.           if f then
  1036.             local info = decodeJson(f:read('*a'))
  1037.             updatelink = info.updateurl
  1038.             updateversion = info.latest
  1039.             f:close()
  1040.             os.remove(json)
  1041.             if updateversion ~= thisScript().version then
  1042.               lua_thread.create(function(prefix)
  1043.                 local dlstatus = require('moonloader').download_status
  1044.                 local color = -1
  1045.                 wait(250)
  1046.                 downloadUrlToFile(updatelink, thisScript().path,
  1047.                   function(id3, status1, p13, p23)
  1048.                     if status1 == dlstatus.STATUS_DOWNLOADINGDATA then
  1049.                       print(string.format('Загружено %d из %d.', p13, p23))
  1050.                     elseif status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
  1051.                       print('Загрузка обновления завершена.')
  1052.  
  1053.                       goupdatestatus = true
  1054.                       lua_thread.create(function() wait(500) thisScript():reload() end)
  1055.                     end
  1056.                     if status1 == dlstatus.STATUSEX_ENDDOWNLOAD then
  1057.                       if goupdatestatus == nil then
  1058.                         update = false
  1059.                       end
  1060.                     end
  1061.                   end
  1062.                 )
  1063.                 end, prefix
  1064.               )
  1065.             else
  1066.               update = false
  1067.             end
  1068.           end
  1069.         else
  1070.           print('v'..thisScript().version..': Не могу проверить обновление. Смиритесь или проверьте самостоятельно на '..url)
  1071.           update = false
  1072.         end
  1073.       end
  1074.     end
  1075.   )
  1076.   while update ~= false do wait(100) end
  1077. end
  1078. function imgui.CenterTextColoredRGB(text)
  1079.     local width = imgui.GetWindowWidth()
  1080.     local style = imgui.GetStyle()
  1081.     local colors = style.Colors
  1082.     local ImVec4 = imgui.ImVec4
  1083.  
  1084.     local explode_argb = function(argb)
  1085.         local a = bit.band(bit.rshift(argb, 24), 0xFF)
  1086.         local r = bit.band(bit.rshift(argb, 16), 0xFF)
  1087.         local g = bit.band(bit.rshift(argb, 8), 0xFF)
  1088.         local b = bit.band(argb, 0xFF)
  1089.         return a, r, g, b
  1090.     end
  1091.  
  1092.     local getcolor = function(color)
  1093.         if color:sub(1, 6):upper() == 'SSSSSS' then
  1094.             local r, g, b = colors[1].x, colors[1].y, colors[1].z
  1095.             local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
  1096.             return ImVec4(r, g, b, a / 255)
  1097.         end
  1098.         local color = type(color) == 'string' and tonumber(color, 16) or color
  1099.         if type(color) ~= 'number' then return end
  1100.         local r, g, b, a = explode_argb(color)
  1101.         return imgui.ImColor(r, g, b, 1000):GetVec4()
  1102.     end
  1103.  
  1104.     local render_text = function(text_)
  1105.         for w in text_:gmatch('[^\r\n]+') do
  1106.             local textsize = w:gsub('{.-}', '')
  1107.             local text_width = imgui.CalcTextSize(u8(textsize))
  1108.             local text, colors_, m = {}, {}, 1
  1109.             w = w:gsub('{(......)}', '{%1FF}')
  1110.             while w:find('{........}') do
  1111.                 local n, k = w:find('{........}')
  1112.                 local color = getcolor(w:sub(n + 1, k - 1))
  1113.                 if color then
  1114.                     text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
  1115.                     colors_[#colors_ + 1] = color
  1116.                     m = n
  1117.                 end
  1118.                 w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
  1119.             end
  1120.             if text[0] then
  1121.                 for i = 0, #text do
  1122.                     imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
  1123.                     imgui.SameLine(nil, 0)
  1124.                 end
  1125.                 imgui.NewLine()
  1126.             else
  1127.                 imgui.Text(u8(w))
  1128.             end
  1129.         end
  1130.     end
  1131.     render_text(text)
  1132. end
  1133. function setMarker(type, x, y, z, radius, color)
  1134.     deleteCheckpoint(marker)
  1135.     removeBlip(checkpoint)
  1136.     checkpoint = addBlipForCoord(x, y, z)
  1137.     marker = createCheckpoint(type, x, y, z, 1, 1, 1, radius)
  1138.     changeBlipColour(checkpoint, color)
  1139.     repeat
  1140.         wait(0)
  1141.         local x1, y1, z1 = getCharCoordinates(PLAYER_PED)
  1142.         until getDistanceBetweenCoords3d(x, y, z, x1, y1, z1) < radius or not doesBlipExist(checkpoint)
  1143.         deleteCheckpoint(marker)
  1144.         removeBlip(checkpoint)
  1145.         addOneOffSound(0, 0, 0, 1149)
  1146. end
  1147. function kvadrat()
  1148.     local KV = {
  1149.         [1] = "А",
  1150.         [2] = "Б",
  1151.         [3] = "В",
  1152.         [4] = "Г",
  1153.         [5] = "Д",
  1154.         [6] = "Ж",
  1155.         [7] = "З",
  1156.         [8] = "И",
  1157.         [9] = "К",
  1158.         [10] = "Л",
  1159.         [11] = "М",
  1160.         [12] = "Н",
  1161.         [13] = "О",
  1162.         [14] = "П",
  1163.         [15] = "Р",
  1164.         [16] = "С",
  1165.         [17] = "Т",
  1166.         [18] = "У",
  1167.         [19] = "Ф",
  1168.         [20] = "Х",
  1169.         [21] = "Ц",
  1170.         [22] = "Ч",
  1171.         [23] = "Ш",
  1172.         [24] = "Я",
  1173.     }
  1174.     local X, Y, Z = getCharCoordinates(playerPed)
  1175.     X = math.ceil((X + 3000) / 250)
  1176.     Y = math.ceil((Y * - 1 + 3000) / 250)
  1177.     Y = KV[Y]
  1178.     local KVX = (Y.."-"..X)
  1179.     return KVX
  1180. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement