Rotti Posted March 27, 2013 Posted March 27, 2013 Hello, I want to stream a song from my server with PlaySound3D. But if i start it it doesn't works. But if i use a radiostream it works! I just want to stream this one song. script (clientside) function disko() song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") end addCommandHandler("diskoparty", disko) Meta: "[GRS]Nitro" version="1.0" type="script" name="speed booster" description="Macht dich schnell" /> client="1.3.0-9.04555" /> Yes, there is a bit more code in the folder. The script is in cars_c.lua and the song is Diskoparty.mp3.
ZL|LuCaS Posted March 27, 2013 Posted March 27, 2013 Hello,I want to stream a song from my server with PlaySound3D. But if i start it it doesn't works. But if i use a radiostream it works! I just want to stream this one song. script (clientside) function disko() song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") end addCommandHandler("diskoparty", disko) Meta: "[GRS]Nitro" version="1.0" type="script" name="speed booster" description="Macht dich schnell" /> client="1.3.0-9.04555" /> Yes, there is a bit more code in the folder. The script is in cars_c.lua and the song is Diskoparty.mp3. function disko() local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") end addCommandHandler("diskoparty", disko) MTA Scripters. ♥♥♥Beijinhos♥♥♥
PaiN^ Posted March 27, 2013 Posted March 27, 2013 In the meta File should be file and without a type ! " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
ZL|LuCaS Posted March 27, 2013 Posted March 27, 2013 In the meta File should be file and without a type ! "Diskoparty.mp3" /> MTA Scripters. ♥♥♥Beijinhos♥♥♥
Rotti Posted March 27, 2013 Author Posted March 27, 2013 Thank you! It worked! This little mistake *.*
PaiN^ Posted March 27, 2013 Posted March 27, 2013 You're welcome .. " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
Rotti Posted March 27, 2013 Author Posted March 27, 2013 One more question: If i trigger the event from the serverside script, how can i make it that everyone can hear it?
PaiN^ Posted March 27, 2013 Posted March 27, 2013 Trigger it to the root triggerClientEvent ( root, 'eventName', root ) I guess ! " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
Jaysds1 Posted March 27, 2013 Posted March 27, 2013 When the sound is going to start playing, simply just trigger a server-side script which will trigger back to the client-side My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Jaysds1 Posted March 27, 2013 Posted March 27, 2013 Ya, that would work to My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Rotti Posted March 27, 2013 Author Posted March 27, 2013 So you mean something like this: --Clientside-- function disko() local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") triggerServerEvent("looper", getRootElement()) end addEventHandler("diskoparty", root, disko) addEvent("diskoparty", true) --Serverside-- function loop() triggerClientEvent("diskoparty", root) end addEvent("looper", true) addEventHandler("looper", getRootElement(), loop)
iPrestege Posted March 27, 2013 Posted March 27, 2013 So you mean something like this: --Clientside-- function disko() local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") triggerServerEvent("looper", getRootElement()) end addEventHandler("diskoparty", root, disko) addEvent("diskoparty", true) --Serverside-- function loop() triggerClientEvent("diskoparty", root) end addEvent("looper", true) addEventHandler("looper", getRootElement(), loop) triggerServerEvent("looper", getRootElement()) > triggerServerEvent("looper",localPlayer)
Jaysds1 Posted March 27, 2013 Posted March 27, 2013 try this: --Clientside-- function disko(play) if not play or play==false then triggerServerEvent("looper", getRootElement()) return end local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") end addEventHandler("diskoparty", root, disko) addEvent("diskoparty", true) --Serverside-- function loop() triggerClientEvent("diskoparty", root,true) end addEvent("looper", true) addEventHandler("looper", getRootElement(), loop) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Rotti Posted March 27, 2013 Author Posted March 27, 2013 no... But in the serverside script i have to trigger the client event first, then the loop will start. maybe the mistake is there. Here is the command: ---------- triggerClientEvent(root, "diskoparty", root) ---------
ZL|LuCaS Posted March 27, 2013 Posted March 27, 2013 no... But in the serverside script i have to trigger the client event first, then the loop will start. maybe the mistake is there.Here is the command: ---------- triggerClientEvent(root, "diskoparty", root) --------- the code is working addEventHandler( 'onClientResourceStart', resourceRoot, function() local x, y, z = getElementPosition (localPlayer) local song = playSound3D("0.mp3", x, y, z, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") end ) addEventHandler( 'onClientResourceStart', resourceRoot, local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) setSoundVolume ( song, 100 ) setSoundMinDistance ( song, 100 ) outputChatBox(":D") end ) MTA Scripters. ♥♥♥Beijinhos♥♥♥
ZL|LuCaS Posted March 27, 2013 Posted March 27, 2013 Hm it worked. thanks without problems. MTA Scripters. ♥♥♥Beijinhos♥♥♥
Rotti Posted March 27, 2013 Author Posted March 27, 2013 Sorry but i have one last question... I want to set the position of the sound with setElementPosition. But the Coordinates for that are comming from a serverside scipt... how can i do this?
PaiN^ Posted March 27, 2013 Posted March 27, 2013 Trigger the client event from the server, And send the coordinates as arguments .. " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
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