Rotti Posted March 27, 2013 Share 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. Link to comment
ZL|LuCaS Posted March 27, 2013 Share 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) Link to comment
PaiN^ Posted March 27, 2013 Share Posted March 27, 2013 In the meta File should be file and without a type ! Link to comment
ZL|LuCaS Posted March 27, 2013 Share Posted March 27, 2013 In the meta File should be file and without a type ! "Diskoparty.mp3" /> Link to comment
Rotti Posted March 27, 2013 Author Share Posted March 27, 2013 Thank you! It worked! This little mistake *.* Link to comment
Rotti Posted March 27, 2013 Author Share 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? Link to comment
PaiN^ Posted March 27, 2013 Share Posted March 27, 2013 Trigger it to the root triggerClientEvent ( root, 'eventName', root ) I guess ! Link to comment
Jaysds1 Posted March 27, 2013 Share 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 Link to comment
Rotti Posted March 27, 2013 Author Share 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) Link to comment
iPrestege Posted March 27, 2013 Share 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) Link to comment
Rotti Posted March 27, 2013 Author Share Posted March 27, 2013 two triggerServerEvents??? Link to comment
Rotti Posted March 27, 2013 Author Share Posted March 27, 2013 I don't even hear the music... Link to comment
Jaysds1 Posted March 27, 2013 Share 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) Link to comment
Rotti Posted March 27, 2013 Author Share 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) --------- Link to comment
ZL|LuCaS Posted March 27, 2013 Share 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 ) Link to comment
ZL|LuCaS Posted March 27, 2013 Share Posted March 27, 2013 Hm it worked. thanks without problems. Link to comment
Rotti Posted March 27, 2013 Author Share 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? Link to comment
PaiN^ Posted March 27, 2013 Share Posted March 27, 2013 Trigger the client event from the server, And send the coordinates as arguments .. Link to comment
Rotti Posted March 27, 2013 Author Share Posted March 27, 2013 i've tried it already... didn't work 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