setPlay3dAudioStreamAtCoordinates

whybladez

Потрачен
Автор темы
14
39
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия MoonLoader
.026-beta
подгружаю sound.wav при выстреле
если стреляю я, то через loadAudioStream + setAudioStreamState работает ТОЛЬКО на себя
когда кто-то другой стреляет, то load3dAudioStream + setPlay3dAudioStreamAtCoordinates не работает
чё делать?


Код:
require "lib.moonloader"
local as_action = require('moonloader').audiostream_state

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end

    checkOther()
    checkMe()
    wait(-1)
end

function checkOther()
    lua_thread.create(function()
        while true do wait(0)
        for i = 0, 1004, 1 do
            isHandle, pPed = sampGetCharHandleBySampPlayerId(i)
            if isHandle then
                isShooting = isCharShooting(pPed)
                if isShooting then
                        sampAddChatMessage('Is Shooting! ID: '..i, -1)
                        if playsoundEx ~= nil then setAudioStreamState(playsoundEx, as_action.STOP) playsoundEx = nil end
                        playsoundEx = load3dAudioStream('moonloader/sound.wav')
                local x, y, z = getCharCoordinates(pPed)
                setPlay3dAudioStreamAtCoordinates(playsoundEx, x, y, z)
                setAudioStreamState(playsoundEx, as_action.PLAY)
                    end
                end
            end
        end
        end)
end

function checkMe()
    lua_thread.create(function()
        while true do wait(0)
        meShot = isCharShooting(PLAYER_PED)
        if meShot then
            isDeagle = isCurrentCharWeapon(PLAYER_PED, 24)
            if isDeagle then
                if playsound ~= nil then setAudioStreamState(playsound, as_action.STOP) playsound = nil end
                playsound = loadAudioStream('moonloader/sound.wav')
                setAudioStreamVolume(playsound, 80)
                setAudioStreamState(playsound, as_action.PLAY)
            end
        end
        end
    end)
end
 

Похожие темы