SlonPvpru

[ARP] Чекер риелторки и упры

Jun 4th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.90 KB | None | 0 0
  1. -- https://www.blast.hk/threads/25959/
  2.  
  3. local imgui = require("imgui")
  4. local encoding = require("encoding")
  5. local u8 = encoding.UTF8
  6. encoding.default = "CP1251"
  7. local window = imgui.ImBool(false)
  8. local musica = u8("Музыка не выбрана")
  9. local checkboxes = {
  10.     enable = imgui.ImBool(false)
  11. }
  12.  
  13. local bass = require "lib.bass"
  14.  
  15. local as_action = require('moonloader').audiostream_state
  16.  
  17. function imgui.OnDrawFrame()
  18.     local x,y = getScreenResolution()
  19.     imgui.SetNextWindowPos(imgui.ImVec2(x / 2, y / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
  20.     imgui.SetNextWindowSize(imgui.ImVec2(500, 550), imgui.Cond.FirstUseEver)
  21.     imgui.Begin(u8("Чекер риелторского и статистического агентства для Advance Role Play"), window)
  22.     imgui.Text(musica)
  23.     imgui.BeginChild("Музыка", imgui.ImVec2(100, 200) , true)
  24.         for i,v in ipairs(findfiles()) do
  25.             if imgui.Button(v) then
  26.                 musickotorayaigraet = bass.BASS_StreamCreateFile(false, "moonloader/checkerarp/music/"..v, 0, 0, 0)
  27.                 bass.BASS_ChannelSetAttribute(musickotorayaigraet, BASS_ATTRIB_VOL, 5)
  28.                 musica = u8("moonloader\\checkerarp\\music\\"..v)
  29.             end
  30.         end
  31.     imgui.EndChild()
  32.     imgui.Separator()
  33.     imgui.Checkbox(u8("Включить/выключить скрипт"), checkboxes.enable)
  34.     imgui.End()
  35. end
  36.  
  37. function main()
  38.     sampRegisterChatCommand("checkarp", function() window.v = not window.v end)
  39.     sampRegisterChatCommand("stopmusic", function() if musickotorayaigraet then bass.BASS_ChannelPause(musickotorayaigraet) else sampAddChatMessage("Не выбрана музыка", -1) end end)
  40.     if not doesDirectoryExist("moonloader\\checkerarp") then
  41.         createDirectory("moonloader\\checkerarp")
  42.         createDirectory("moonloader\\checkerarp\\music")
  43.     end
  44.     while true do
  45.         wait(0)
  46.         imgui.Process = window.v
  47.     end
  48. end
  49.  
  50. local ev = require("samp.events")
  51.  
  52. function ev.onCreate3DText(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text)
  53.     if color == 1721368575 and id == 1026 and checkboxes.enable then
  54.         if not textrielt then
  55.             textrielt = text:gsub("%s", "")
  56.         elseif textrielt ~= text:gsub("%s", "") and musickotorayaigraet then
  57.             bass.BASS_ChannelPlay(musickotorayaigraet, false)
  58.             textrielt = text:gsub("%s", "")
  59.             print("patriot")
  60.         end
  61.     elseif color == 1721368575 and id == 1024 and checkboxes.enable then
  62.         if not textbiz then
  63.             textbiz = text:gsub("%s", "")
  64.         elseif textbiz ~= text:gsub("%s", "") and musickotorayaigraet then
  65.             bass.BASS_ChannelPlay(musickotorayaigraet, false)
  66.             textbiz = text:gsub("%s", "")
  67.             print("patriot")
  68.         end
  69.     end
  70. end
  71.  
  72. function findfiles()
  73.     files = {}
  74.     local handleFile, nameFile = findFirstFile('moonloader/checkerarp/music/*.mp3')
  75.     while nameFile do
  76.         if handleFile then
  77.             if not nameFile then
  78.                 findClose(handleFile)
  79.             else
  80.                 table.insert(files, nameFile)
  81.                 nameFile = findNextFile(handleFile)
  82.             end
  83.         end
  84.     end
  85.     return files
  86. end
Add Comment
Please, Sign In to add comment