Можешь написать рабочий отредактированный код, если не тяжело?
local as_action = require('moonloader').audiostream_state
local sampev = require('lib.samp.events')
function main()
while not isSampAvailable() do wait(100) end
dirMusic = loadAudioStream('moonloader/nevern.mp3')
wait(-1)
end
function sampev.onServerMessage(color, text)
if text:find('Неверный код!') and dirMusic ~= nil then
setAudioStreamState(dirMusic, as_action.PLAY)
setAudioStreamVolume(dirMusic, 50)
end
end
Пытаешься использовать самповские функции до загрузки самого сампа?Здравствуйте, господа! Возникла проблема, что скрипт работает только после перезагрузки скриптов в игре. При заходе в игру он не активируется. В чём может быть причина?
Пытаешься использовать самповские функции до загрузки самого сампа?
local as_action = require('moonloader').audiostream_state
local sampev = require('lib.samp.events')
local dirMusic = loadAudioStream('moonloader/nevern.mp3')
function sampev.onServerMessage(color, text)
if text:find('Неверный код!') and dirMusic ~= nil then
setAudioStreamState(dirMusic, as_action.PLAY)
setAudioStreamVolume(dirMusic, 50)
end
end
Попробуй в мейне устанавливать значение, после загрузки сампаLua:local as_action = require('moonloader').audiostream_state local sampev = require('lib.samp.events') local dirMusic = loadAudioStream('moonloader/nevern.mp3') function sampev.onServerMessage(color, text) if text:find('Неверный код!') and dirMusic ~= nil then setAudioStreamState(dirMusic, as_action.PLAY) setAudioStreamVolume(dirMusic, 50) end end
Можешь расшифровать "для тупых"?)Попробуй в мейне устанавливать значение, после загрузки сампа
Можешь расшифровать "для тупых"?)
local as_action = require('moonloader').audiostream_state
local sampev = require('lib.samp.events')
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
local dirMusic = loadAudioStream('moonloader/nevern.mp3')
while true do
wait(-1)
end
end
function sampev.onServerMessage(color, text)
if text:find('Неверный код!') and dirMusic ~= nil then
setAudioStreamState(dirMusic, as_action.PLAY)
setAudioStreamVolume(dirMusic, 50)
end
end
хуйню скинул, нихуя работать не будет как минимум потому что ты сделал dirMusic локальным для main`а, а onServerMessage по просту не увидит эту переменнуюLua:local as_action = require('moonloader').audiostream_state local sampev = require('lib.samp.events') function main() if not isSampfuncsLoaded() or not isSampLoaded() then return end while not isSampAvailable() do wait(100) end local dirMusic = loadAudioStream('moonloader/nevern.mp3') while true do wait(-1) end end function sampev.onServerMessage(color, text) if text:find('Неверный код!') and dirMusic ~= nil then setAudioStreamState(dirMusic, as_action.PLAY) setAudioStreamVolume(dirMusic, 50) end end
Можешь написать рабочий отредактированный код, если не тяжело?хуйню скинул, нихуя работать не будет как минимум потому что ты сделал dirMusic локальным для main`а, а onServerMessage по просту не увидит эту переменную
вынеси ее из мейна и не делай локальной в мейне
Можешь написать рабочий отредактированный код, если не тяжело?
local as_action = require('moonloader').audiostream_state
local sampev = require('lib.samp.events')
function main()
while not isSampAvailable() do wait(100) end
dirMusic = loadAudioStream('moonloader/nevern.mp3')
wait(-1)
end
function sampev.onServerMessage(color, text)
if text:find('Неверный код!') and dirMusic ~= nil then
setAudioStreamState(dirMusic, as_action.PLAY)
setAudioStreamVolume(dirMusic, 50)
end
end