Как в lua воспроизвести аудиофайл ?

Решение
Код:
local vkeys = require 'vkeys'
local wm = require 'lib.windows.message'
local imgui = require 'imgui'
local encoding = require 'encoding'
local rkeys = require 'rkeys'
imgui.ToggleButton = require('imgui_addons').ToggleButton
imgui.HotKey = require('imgui_addons').HotKey
imgui.Spinner = require('imgui_addons').Spinner
imgui.BufferingBar = require('imgui_addons').BufferingBar
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.ImBool(false)
local ActiveMenu = {
    v = {vkeys.VK_F3}
}
local bindID = 0

function main()
   if not isSampLoaded() then
      return
   end
   while not isSampAvailable() do
      wait(0)
    end
    sampRegisterChatCommand("audioPlayer", function ()
        window.v = not window.v...

scroll.

bud' chelovekom
Проверенный
4,149
1,391
Ооо, получилось. Спасибо
А как зарегаться на вики бх?
Письмо на почту не приходит
Данные от бх введи и всё
1649417175400.png
 

Savchik Blazer

Но я, мечту свою лелея...
Автор темы
Проверенный
668
294
SA-MP 0.3.7
Exception At Address: 0x66B5C991
Base: 0x03D80000

Registers:
EAX: 0x00000004 EBX: 0x0EDD01C0 ECX: 0x0177F138 EDX: 0x00000008
ESI: 0x66B62480 EDI: 0x66B54120 EBP: 0x0177F17C ESP: 0x0177F138
EFLAGS: 0x00210202

Stack:
+0000: 0x00000000 0x00000000 0x0EDD02CC 0x0EDD0D58
+0010: 0x0EE45640 0x66B4F370 0x0EDD01C0 0x66B54120
+0020: 0x0EDD02CC 0x0EDD0D58 0x00000000 0x668C602E
+0030: 0x0EDD1380 0x0177F154 0x0177F1A8 0x66C9B260
+0040: 0x00000000 0x0EDD01C0 0x6688280D 0x0EDD01C0
+0050: 0x0EDD1380 0x0177F194 0x0EDD1380 0x0EDD49F8
+0060: 0xFFFFFFFB 0x0EDD2D00 0x00000008 0x0177F1C4
+0070: 0x0177F280 0x668A4360 0x00000000 0x0EE45570
+0080: 0x0EDD01F0 0x1DAD2CE8 0x668873EB 0x0EDD01C0
+0090: 0x00000000 0x00000000 0x00000008 0x1DAD2CE8
+00A0: 0x0EDD01C0 0x00000001 0x66B292B2 0x0EDD01C0
+00B0: 0x00000000 0xFFFFFFFF 0x00000001 0x0EDD01C0
+00C0: 0x0EDD01C0 0x0177F28C 0x00000000 0x66B25CA0
+00D0: 0x0177F24C 0x01BA10BC 0x01BA10BC 0x00000000
+00E0: 0x0177F260 0x01BA10B0 0x01AED330 0xFFFFFFFF
+00F0: 0x0177F2D4 0x65DD01A8 0x65E95993 0x515A4E57
+0100: 0x262DF084 0x65E94DD0 0x00000000 0x262DF0B4
+0110: 0x0B4DFDE0 0x12A501C0 0x00000001 0x00000000
+0120: 0x00000000 0x00000000 0x1DAD2CF0 0x00000001
+0130: 0x1DAEEFC8 0x0B4DFDE0 0x1DAD2CF8 0x1DAD2CE8
+0140: 0x00000000 0x1DAD2CF0 0x0177F2B4 0x66C98E59
+0150: 0x00000001 0x0177F2C0 0x66B2B6DC 0x01BA10BC
+0160: 0x66B36BCC 0x01AED330 0x01BA10B0 0xFFFFFFFF
+0170: 0x0E7F224A 0xFFFFFFFE 0x0177F29C 0x0177F30C
+0180: 0x66C99E98 0x00000001 0x0177F318 0x66B2488C
+0190: 0x66CA8C68 0x01BA10B8 0x00001F80 0x0000007F
+01A0: 0x65E8027F 0x0177F2EC 0x66C79BF0 0x0009001F
+01B0: 0xFFF7FFFF 0x0177F2C8 0x1B09EB1C 0x0533E8F8
+01C0: 0x030A001F 0x01AF66D4 0x66B24070 0x77437910
+01D0: 0x030A001F 0x0177F5F4 0x66C98DC8 0x00000000
+01E0: 0x0177F34C 0x666C5832 0x0B5277C8 0x00000000
+01F0: 0x00000000 0x00000000 0x00000000 0x1B2FBF80
+0200: 0x01B01368 0x00000011 0x01AFBB60 0x66660000
+0210: 0x01B01368 0x0177F604 0x03DF167E 0x01B7DD90
+0220: 0x00000000 0x00000000 0x00000000 0x00000000
+0230: 0x0533E8F8 0x007F99B0 0xFFFFFFFF 0x00000000
+0240: 0x20DEF790 0x01C333C8 0x0177F4BC 0x00000000
+0250: 0x00000790 0x00000000 0x00000770 0x00000000
+0260: 0x00000790 0x01C333C8 0x0B8A88A0 0x00000123
+0270: 0x20D7C830 0x01C333C8 0x00000000 0x00000005

SCM Op: 0x248, lDbg: 0 LastRendObj: 0

Game Version: US 1.0

State Information: Ped Context: 0
P0 (32,0) P49 (0,0)




крашит
 

chapo

чопа сребдс // @moujeek
Модератор
8,868
11,572
SA-MP 0.3.7
Exception At Address: 0x66B5C991
Base: 0x03D80000

Registers:
EAX: 0x00000004 EBX: 0x0EDD01C0 ECX: 0x0177F138 EDX: 0x00000008
ESI: 0x66B62480 EDI: 0x66B54120 EBP: 0x0177F17C ESP: 0x0177F138
EFLAGS: 0x00210202

Stack:
+0000: 0x00000000 0x00000000 0x0EDD02CC 0x0EDD0D58
+0010: 0x0EE45640 0x66B4F370 0x0EDD01C0 0x66B54120
+0020: 0x0EDD02CC 0x0EDD0D58 0x00000000 0x668C602E
+0030: 0x0EDD1380 0x0177F154 0x0177F1A8 0x66C9B260
+0040: 0x00000000 0x0EDD01C0 0x6688280D 0x0EDD01C0
+0050: 0x0EDD1380 0x0177F194 0x0EDD1380 0x0EDD49F8
+0060: 0xFFFFFFFB 0x0EDD2D00 0x00000008 0x0177F1C4
+0070: 0x0177F280 0x668A4360 0x00000000 0x0EE45570
+0080: 0x0EDD01F0 0x1DAD2CE8 0x668873EB 0x0EDD01C0
+0090: 0x00000000 0x00000000 0x00000008 0x1DAD2CE8
+00A0: 0x0EDD01C0 0x00000001 0x66B292B2 0x0EDD01C0
+00B0: 0x00000000 0xFFFFFFFF 0x00000001 0x0EDD01C0
+00C0: 0x0EDD01C0 0x0177F28C 0x00000000 0x66B25CA0
+00D0: 0x0177F24C 0x01BA10BC 0x01BA10BC 0x00000000
+00E0: 0x0177F260 0x01BA10B0 0x01AED330 0xFFFFFFFF
+00F0: 0x0177F2D4 0x65DD01A8 0x65E95993 0x515A4E57
+0100: 0x262DF084 0x65E94DD0 0x00000000 0x262DF0B4
+0110: 0x0B4DFDE0 0x12A501C0 0x00000001 0x00000000
+0120: 0x00000000 0x00000000 0x1DAD2CF0 0x00000001
+0130: 0x1DAEEFC8 0x0B4DFDE0 0x1DAD2CF8 0x1DAD2CE8
+0140: 0x00000000 0x1DAD2CF0 0x0177F2B4 0x66C98E59
+0150: 0x00000001 0x0177F2C0 0x66B2B6DC 0x01BA10BC
+0160: 0x66B36BCC 0x01AED330 0x01BA10B0 0xFFFFFFFF
+0170: 0x0E7F224A 0xFFFFFFFE 0x0177F29C 0x0177F30C
+0180: 0x66C99E98 0x00000001 0x0177F318 0x66B2488C
+0190: 0x66CA8C68 0x01BA10B8 0x00001F80 0x0000007F
+01A0: 0x65E8027F 0x0177F2EC 0x66C79BF0 0x0009001F
+01B0: 0xFFF7FFFF 0x0177F2C8 0x1B09EB1C 0x0533E8F8
+01C0: 0x030A001F 0x01AF66D4 0x66B24070 0x77437910
+01D0: 0x030A001F 0x0177F5F4 0x66C98DC8 0x00000000
+01E0: 0x0177F34C 0x666C5832 0x0B5277C8 0x00000000
+01F0: 0x00000000 0x00000000 0x00000000 0x1B2FBF80
+0200: 0x01B01368 0x00000011 0x01AFBB60 0x66660000
+0210: 0x01B01368 0x0177F604 0x03DF167E 0x01B7DD90
+0220: 0x00000000 0x00000000 0x00000000 0x00000000
+0230: 0x0533E8F8 0x007F99B0 0xFFFFFFFF 0x00000000
+0240: 0x20DEF790 0x01C333C8 0x0177F4BC 0x00000000
+0250: 0x00000790 0x00000000 0x00000770 0x00000000
+0260: 0x00000790 0x01C333C8 0x0B8A88A0 0x00000123
+0270: 0x20D7C830 0x01C333C8 0x00000000 0x00000005

SCM Op: 0x248, lDbg: 0 LastRendObj: 0

Game Version: US 1.0

State Information: Ped Context: 0
P0 (32,0) P49 (0,0)




крашит
ок, рад за тебя, но было бы проще если бы ты скинул код
 
  • Ха-ха
Реакции: scroll.

Savchik Blazer

Но я, мечту свою лелея...
Автор темы
Проверенный
668
294
Код:
local vkeys = require 'vkeys'
local wm = require 'lib.windows.message'
local imgui = require 'imgui'
local encoding = require 'encoding'
local rkeys = require 'rkeys'
imgui.ToggleButton = require('imgui_addons').ToggleButton
imgui.HotKey = require('imgui_addons').HotKey
imgui.Spinner = require('imgui_addons').Spinner
imgui.BufferingBar = require('imgui_addons').BufferingBar
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.ImBool(false)
local ActiveMenu = {
    v = {vkeys.VK_F3}
}
local bindID = 0

function main()
   if not isSampLoaded() then
      return
   end
   while not isSampAvailable() do
      wait(0)
    end
    sampRegisterChatCommand("audioPlayer", function ()
        window.v = not window.v
    end)
    bindID = rkeys.registerHotKey(ActiveMenu.v, true, function ()
        window.v = not window.v
    end)
    while true do
        wait(0)
        imgui.Process = window.v
    end
end

function apply_custom_style()
  imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4
    local ImVec2 = imgui.ImVec2

    style.WindowPadding = imgui.ImVec2(8, 8)
    style.WindowRounding = 6
    style.ChildWindowRounding = 5
    style.FramePadding = imgui.ImVec2(5, 3)
    style.FrameRounding = 3.0
    style.ItemSpacing = imgui.ImVec2(5, 4)
    style.ItemInnerSpacing = imgui.ImVec2(4, 4)
    style.IndentSpacing = 21
    style.ScrollbarSize = 10.0
    style.ScrollbarRounding = 13
    style.GrabMinSize = 8
    style.GrabRounding = 1
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

        colors[clr.Text]                   = ImVec4(0.00, 0.00, 0.00, 1.00);
        colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00);
        colors[clr.WindowBg]               = ImVec4(0.86, 0.86, 0.86, 1.00);
        colors[clr.ChildWindowBg]          = ImVec4(0.71, 0.71, 0.71, 1.00);
        colors[clr.PopupBg]                = ImVec4(0.79, 0.79, 0.79, 1.00);
        colors[clr.Border]                 = ImVec4(0.00, 0.00, 0.00, 0.36);
        colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.10);
        colors[clr.FrameBg]                = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.FrameBgHovered]         = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.FrameBgActive]          = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.TitleBg]                = ImVec4(1.00, 1.00, 1.00, 0.81);
        colors[clr.TitleBgActive]          = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.TitleBgCollapsed]       = ImVec4(1.00, 1.00, 1.00, 0.51);
        colors[clr.MenuBarBg]              = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.ScrollbarBg]            = ImVec4(1.00, 1.00, 1.00, 0.86);
        colors[clr.ScrollbarGrab]          = ImVec4(0.37, 0.37, 0.37, 1.00);
        colors[clr.ScrollbarGrabHovered]   = ImVec4(0.60, 0.60, 0.60, 1.00);
        colors[clr.ScrollbarGrabActive]    = ImVec4(0.21, 0.21, 0.21, 1.00);
        colors[clr.ComboBg]                = ImVec4(0.61, 0.61, 0.61, 1.00);
        colors[clr.CheckMark]              = ImVec4(0.42, 0.42, 0.42, 1.00);
        colors[clr.SliderGrab]             = ImVec4(0.51, 0.51, 0.51, 1.00);
        colors[clr.SliderGrabActive]       = ImVec4(0.65, 0.65, 0.65, 1.00);
        colors[clr.Button]                 = ImVec4(0.52, 0.52, 0.52, 0.83);
        colors[clr.ButtonHovered]          = ImVec4(0.58, 0.58, 0.58, 0.83);
        colors[clr.ButtonActive]           = ImVec4(0.44, 0.44, 0.44, 0.83);
        colors[clr.Header]                 = ImVec4(0.65, 0.65, 0.65, 1.00);
        colors[clr.HeaderHovered]          = ImVec4(0.73, 0.73, 0.73, 1.00);
        colors[clr.HeaderActive]           = ImVec4(0.53, 0.53, 0.53, 1.00);
        colors[clr.Separator]              = ImVec4(0.46, 0.46, 0.46, 1.00);
        colors[clr.SeparatorHovered]       = ImVec4(0.45, 0.45, 0.45, 1.00);
        colors[clr.SeparatorActive]        = ImVec4(0.45, 0.45, 0.45, 1.00);
        colors[clr.ResizeGrip]             = ImVec4(0.23, 0.23, 0.23, 1.00);
        colors[clr.ResizeGripHovered]      = ImVec4(0.32, 0.32, 0.32, 1.00);
        colors[clr.ResizeGripActive]       = ImVec4(0.14, 0.14, 0.14, 1.00);
        colors[clr.CloseButton]            = ImVec4(0.40, 0.39, 0.38, 0.16);
        colors[clr.CloseButtonHovered]     = ImVec4(0.40, 0.39, 0.38, 0.39);
        colors[clr.CloseButtonActive]      = ImVec4(0.40, 0.39, 0.38, 1.00);
        colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00);
        colors[clr.PlotLinesHovered]       = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.PlotHistogram]          = ImVec4(0.70, 0.70, 0.70, 1.00);
        colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.TextSelectedBg]         = ImVec4(0.62, 0.62, 0.62, 1.00);
        colors[clr.ModalWindowDarkening]   = ImVec4(0.26, 0.26, 0.26, 0.60);
end
apply_custom_style()

local imBool = imgui.ImBool(false)
local imBool2 = imgui.ImBool(false)
local imBool3 = imgui.ImBool(false)
local imBool4 = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local tLastKeys = {}

   imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth / 2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
   imgui.SetNextWindowSize(imgui.ImVec2(400, 200), imgui.Cond.FirstUseEver)

   imgui.Begin("Test Window", window)

imgui.Text(u8("track 1"))
imgui.SameLine()
if imgui.Button(u8('play')) then
    track1 = loadAudioStream(getWorkingDirectory() .. "moonloader/resource/audioPlayer/track1.wav")
    releaseAudioStream(track1)
end
   imgui.End()
end
 

chapo

чопа сребдс // @moujeek
Модератор
8,868
11,572
Код:
local vkeys = require 'vkeys'
local wm = require 'lib.windows.message'
local imgui = require 'imgui'
local encoding = require 'encoding'
local rkeys = require 'rkeys'
imgui.ToggleButton = require('imgui_addons').ToggleButton
imgui.HotKey = require('imgui_addons').HotKey
imgui.Spinner = require('imgui_addons').Spinner
imgui.BufferingBar = require('imgui_addons').BufferingBar
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.ImBool(false)
local ActiveMenu = {
    v = {vkeys.VK_F3}
}
local bindID = 0

function main()
   if not isSampLoaded() then
      return
   end
   while not isSampAvailable() do
      wait(0)
    end
    sampRegisterChatCommand("audioPlayer", function ()
        window.v = not window.v
    end)
    bindID = rkeys.registerHotKey(ActiveMenu.v, true, function ()
        window.v = not window.v
    end)
    while true do
        wait(0)
        imgui.Process = window.v
    end
end

function apply_custom_style()
  imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4
    local ImVec2 = imgui.ImVec2

    style.WindowPadding = imgui.ImVec2(8, 8)
    style.WindowRounding = 6
    style.ChildWindowRounding = 5
    style.FramePadding = imgui.ImVec2(5, 3)
    style.FrameRounding = 3.0
    style.ItemSpacing = imgui.ImVec2(5, 4)
    style.ItemInnerSpacing = imgui.ImVec2(4, 4)
    style.IndentSpacing = 21
    style.ScrollbarSize = 10.0
    style.ScrollbarRounding = 13
    style.GrabMinSize = 8
    style.GrabRounding = 1
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

        colors[clr.Text]                   = ImVec4(0.00, 0.00, 0.00, 1.00);
        colors[clr.TextDisabled]           = ImVec4(0.50, 0.50, 0.50, 1.00);
        colors[clr.WindowBg]               = ImVec4(0.86, 0.86, 0.86, 1.00);
        colors[clr.ChildWindowBg]          = ImVec4(0.71, 0.71, 0.71, 1.00);
        colors[clr.PopupBg]                = ImVec4(0.79, 0.79, 0.79, 1.00);
        colors[clr.Border]                 = ImVec4(0.00, 0.00, 0.00, 0.36);
        colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.10);
        colors[clr.FrameBg]                = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.FrameBgHovered]         = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.FrameBgActive]          = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.TitleBg]                = ImVec4(1.00, 1.00, 1.00, 0.81);
        colors[clr.TitleBgActive]          = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.TitleBgCollapsed]       = ImVec4(1.00, 1.00, 1.00, 0.51);
        colors[clr.MenuBarBg]              = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.ScrollbarBg]            = ImVec4(1.00, 1.00, 1.00, 0.86);
        colors[clr.ScrollbarGrab]          = ImVec4(0.37, 0.37, 0.37, 1.00);
        colors[clr.ScrollbarGrabHovered]   = ImVec4(0.60, 0.60, 0.60, 1.00);
        colors[clr.ScrollbarGrabActive]    = ImVec4(0.21, 0.21, 0.21, 1.00);
        colors[clr.ComboBg]                = ImVec4(0.61, 0.61, 0.61, 1.00);
        colors[clr.CheckMark]              = ImVec4(0.42, 0.42, 0.42, 1.00);
        colors[clr.SliderGrab]             = ImVec4(0.51, 0.51, 0.51, 1.00);
        colors[clr.SliderGrabActive]       = ImVec4(0.65, 0.65, 0.65, 1.00);
        colors[clr.Button]                 = ImVec4(0.52, 0.52, 0.52, 0.83);
        colors[clr.ButtonHovered]          = ImVec4(0.58, 0.58, 0.58, 0.83);
        colors[clr.ButtonActive]           = ImVec4(0.44, 0.44, 0.44, 0.83);
        colors[clr.Header]                 = ImVec4(0.65, 0.65, 0.65, 1.00);
        colors[clr.HeaderHovered]          = ImVec4(0.73, 0.73, 0.73, 1.00);
        colors[clr.HeaderActive]           = ImVec4(0.53, 0.53, 0.53, 1.00);
        colors[clr.Separator]              = ImVec4(0.46, 0.46, 0.46, 1.00);
        colors[clr.SeparatorHovered]       = ImVec4(0.45, 0.45, 0.45, 1.00);
        colors[clr.SeparatorActive]        = ImVec4(0.45, 0.45, 0.45, 1.00);
        colors[clr.ResizeGrip]             = ImVec4(0.23, 0.23, 0.23, 1.00);
        colors[clr.ResizeGripHovered]      = ImVec4(0.32, 0.32, 0.32, 1.00);
        colors[clr.ResizeGripActive]       = ImVec4(0.14, 0.14, 0.14, 1.00);
        colors[clr.CloseButton]            = ImVec4(0.40, 0.39, 0.38, 0.16);
        colors[clr.CloseButtonHovered]     = ImVec4(0.40, 0.39, 0.38, 0.39);
        colors[clr.CloseButtonActive]      = ImVec4(0.40, 0.39, 0.38, 1.00);
        colors[clr.PlotLines]              = ImVec4(0.61, 0.61, 0.61, 1.00);
        colors[clr.PlotLinesHovered]       = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.PlotHistogram]          = ImVec4(0.70, 0.70, 0.70, 1.00);
        colors[clr.PlotHistogramHovered]   = ImVec4(1.00, 1.00, 1.00, 1.00);
        colors[clr.TextSelectedBg]         = ImVec4(0.62, 0.62, 0.62, 1.00);
        colors[clr.ModalWindowDarkening]   = ImVec4(0.26, 0.26, 0.26, 0.60);
end
apply_custom_style()

local imBool = imgui.ImBool(false)
local imBool2 = imgui.ImBool(false)
local imBool3 = imgui.ImBool(false)
local imBool4 = imgui.ImBool(false)

function imgui.OnDrawFrame()
    local iScreenWidth, iScreenHeight = getScreenResolution()
    local tLastKeys = {}

   imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth / 2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
   imgui.SetNextWindowSize(imgui.ImVec2(400, 200), imgui.Cond.FirstUseEver)

   imgui.Begin("Test Window", window)

imgui.Text(u8("track 1"))
imgui.SameLine()
if imgui.Button(u8('play')) then
    track1 = loadAudioStream(getWorkingDirectory() .. "moonloader/resource/audioPlayer/track1.wav")
    releaseAudioStream(track1)
end
   imgui.End()
end
Lua:
local file = getWorkingDirectory()..'\\resource\\sound.mp3'
if doesFileExist(file) then
    local sound = loadAudioStream(file)
    setAudioStreamState(sound, 1)
end
 

NikkiReuz

Участник
54
4
Lua:
local file = getWorkingDirectory()..'\\resource\\sound.mp3'
if doesFileExist(file) then
    local sound = loadAudioStream(file)
    setAudioStreamState(sound, 1)
end
Теперь его можно использовать как:
lua:
local file = getWorkingDirectory()..'\\resource\\sound.mp3'
if doesFileExist(file) then
    local sound = loadAudioStream(file)
    setAudioStreamState(sound, 1)
end

if imgui.Button("Play Sound") then
sound
end

Или не так?