#Iniciante3D Posted November 18, 2014 Share Posted November 18, 2014 (edited) Olá a todos. Estou com uma dúvida no seguinte, fiz um script para a policia que, ao apertar um botão, neste caso 7 sai um som de sirene, porém só sai para a pessoa que apertou o botão (7) queria deixar para todos ouvir. Script abaixo: function bindHoron(_,state,veh) local veh = getPedOccupiedVehicle(localPlayer) local x,y,z = getElementPosition(veh) if isElement(veh) then if ( state == "down" ) then sound = playSound3D ("som.mp3",x,y,z) setSoundMinDistance(sound,1.0) setSoundMaxDistance(sound, 100) attachElements (sound,veh) elseif ( state == "up" ) then if isElement( sound ) then stopSound( sound ) end end end end bindKey("7", "down", bindHoron) bindKey("7", "up",bindHoron) Edited November 19, 2014 by Guest Link to comment
_Vodka_ Posted November 18, 2014 Share Posted November 18, 2014 Tente isto (não foi testado) e tambem não sou o melhor scripter (ainda aprendendo ) addEventHandler( 'onClientResourceStart', resourceRoot, function bindHoron(_,state,veh) local veh = getPedOccupiedVehicle(localPlayer) local x,y,z = getElementPosition(veh) if isElement(veh) then if ( state == "down" ) then local sound = playSound3D ("som.mp3",x,y,z, true) setSoundMaxDistance( uSound, 100 ) attachElements (sound,veh) elseif ( state == "up" ) then if isElement( sound ) then stopSound( sound ) end end end end ) bindKey("7", "down", bindHoron) bindKey("7", "up",bindHoron) O que substitui: sound = playSound3D ("som.mp3",x,y,z) para local sound = playSound3D ("som.mp3",x,y,z, true) e setSoundMinDistance(sound,1.0) setSoundMaxDistance(sound, 100) para setSoundMaxDistance( uSound, 100 ) Também veja isto que pode o ajudar: https://wiki.multitheftauto.com/wiki/PlaySound3D Link to comment
#Iniciante3D Posted November 19, 2014 Author Share Posted November 19, 2014 Obrigado por tentar ajudar, mas não funcionou. Agradeço. Link to comment
manawydan Posted November 19, 2014 Share Posted November 19, 2014 creio que vc devera cria um evento e mandar um trigger para mandar o som pra todos os players Link to comment
#Iniciante3D Posted November 19, 2014 Author Share Posted November 19, 2014 Obrigado manawydan, pegou corretamente Link to comment
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