Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://www.blast.hk/threads/25959/
- local imgui = require("imgui")
- local encoding = require("encoding")
- local u8 = encoding.UTF8
- encoding.default = "CP1251"
- local window = imgui.ImBool(false)
- local musica = u8("Музыка не выбрана")
- local checkboxes = {
- enable = imgui.ImBool(false)
- }
- local bass = require "lib.bass"
- local as_action = require('moonloader').audiostream_state
- function imgui.OnDrawFrame()
- local x,y = getScreenResolution()
- imgui.SetNextWindowPos(imgui.ImVec2(x / 2, y / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
- imgui.SetNextWindowSize(imgui.ImVec2(500, 550), imgui.Cond.FirstUseEver)
- imgui.Begin(u8("Чекер риелторского и статистического агентства для Advance Role Play"), window)
- imgui.Text(musica)
- imgui.BeginChild("Музыка", imgui.ImVec2(100, 200) , true)
- for i,v in ipairs(findfiles()) do
- if imgui.Button(v) then
- musickotorayaigraet = bass.BASS_StreamCreateFile(false, "moonloader/checkerarp/music/"..v, 0, 0, 0)
- bass.BASS_ChannelSetAttribute(musickotorayaigraet, BASS_ATTRIB_VOL, 5)
- musica = u8("moonloader\\checkerarp\\music\\"..v)
- end
- end
- imgui.EndChild()
- imgui.Separator()
- imgui.Checkbox(u8("Включить/выключить скрипт"), checkboxes.enable)
- imgui.End()
- end
- function main()
- sampRegisterChatCommand("checkarp", function() window.v = not window.v end)
- sampRegisterChatCommand("stopmusic", function() if musickotorayaigraet then bass.BASS_ChannelPause(musickotorayaigraet) else sampAddChatMessage("Не выбрана музыка", -1) end end)
- if not doesDirectoryExist("moonloader\\checkerarp") then
- createDirectory("moonloader\\checkerarp")
- createDirectory("moonloader\\checkerarp\\music")
- end
- while true do
- wait(0)
- imgui.Process = window.v
- end
- end
- local ev = require("samp.events")
- function ev.onCreate3DText(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text)
- if color == 1721368575 and id == 1026 and checkboxes.enable then
- if not textrielt then
- textrielt = text:gsub("%s", "")
- elseif textrielt ~= text:gsub("%s", "") and musickotorayaigraet then
- bass.BASS_ChannelPlay(musickotorayaigraet, false)
- textrielt = text:gsub("%s", "")
- print("patriot")
- end
- elseif color == 1721368575 and id == 1024 and checkboxes.enable then
- if not textbiz then
- textbiz = text:gsub("%s", "")
- elseif textbiz ~= text:gsub("%s", "") and musickotorayaigraet then
- bass.BASS_ChannelPlay(musickotorayaigraet, false)
- textbiz = text:gsub("%s", "")
- print("patriot")
- end
- end
- end
- function findfiles()
- files = {}
- local handleFile, nameFile = findFirstFile('moonloader/checkerarp/music/*.mp3')
- while nameFile do
- if handleFile then
- if not nameFile then
- findClose(handleFile)
- else
- table.insert(files, nameFile)
- nameFile = findNextFile(handleFile)
- end
- end
- end
- return files
- end
Add Comment
Please, Sign In to add comment