Governador Posted December 17, 2013 Posted December 17, 2013 Eaê pessou, joia? Seguindo, eu kria saber adaptar isso aq: local x,y,z = getElementPosition(getLocalPlayer()) local som = playSound3D("caminho", x,y,z) setSoundMaxDistance( som, 30 ) para pôr juntamente com essa função: if itemName == "repairvehicle" then local col = getElementData(getLocalPlayer(), "currentCol") triggerServerEvent("repairVehicle", getLocalPlayer(), getElementData(col, "parent")) playSound("sounds/repair.mp3") disableMenu() return end tipo, seguinte, quem tá próximo, irá escutar a ação q 1 player individualmente executar, entendem? Grato!
Stanley Sathler Posted December 17, 2013 Posted December 17, 2013 DayZ descompilado né, malandrão? Conheeeeeço, haha. Cara, só substituir a função "playSound()" presente no segundo código apresentado pelas linhas do primeiro código. Mais ou menos assim: if itemName == "repairvehicle" then local col = getElementData(getLocalPlayer(), "currentCol") triggerServerEvent("repairVehicle", getLocalPlayer(), getElementData(col, "parent")) local soundX,soundY,soundZ = getElementPosition(getLocalPlayer()) local som = playSound3D("sounds/repair.mp3", soundX, soundY, soundZ) setSoundMaxDistance( som, 30 ) disableMenu() return end Acho que isso funciona. Nomeei as variáveis como "soundX, soundY e soundZ" pra não correr o risco de dar conflito com qualquer outra ocorrência de variáveis com o nome "x,y,z" que possa existir no código. Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
Governador Posted December 19, 2013 Author Posted December 19, 2013 vlws lekao! ^^ rs vou testar aq, qualquer coisa aviso. @EDIT function playerUseItem(itemName, itemInfo) if itemInfo == "Beber" then local soundX,soundY,soundZ = getElementPosition(getLocalPlayer()) local som = playSound3D("sounds/bebendo.ogg", soundX, soundY, soundZ) triggerServerEvent("onPlayerRequestChangingStats", getLocalPlayer(), itemName, itemInfo, "thirst") setSoundMaxDistance(som, 15) Aí lek, testei e tals com um parça aq, mais aí só quem ouve é quem executa a ação.
DNL291 Posted December 19, 2013 Posted December 19, 2013 playSound3D é tocado apenas para o jogador local. Please do not PM me with scripting related question nor support, use the forums instead.
Governador Posted December 19, 2013 Author Posted December 19, 2013 playSound3D é tocado apenas para o jogador local. Então no caso ficaria como, se fosse pra adaptar como falei? E qual a função q se usa para um player próximo? Grato!
DNL291 Posted December 20, 2013 Posted December 20, 2013 Você pode usar triggerClientEvent, e acionar a função para todos os jogadores usando o primeiro argumento da função. Please do not PM me with scripting related question nor support, use the forums instead.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now