DhrJay Posted December 22, 2012 Posted December 22, 2012 Hi Guys! I found this script, and I wanted to expand the reach of the stream. the resource works perfectly, but you can only hear the music when you move your camera to the speaker... Does anyone know how to change this? Client: local url = "http://www.di.fm/mp3/hardstyle.pls" function playTheSound(x, y, z, vehicle) sound = playSound3D(url, x, y, z) if (isElement(vehicle)) then attachElements(sound, vehicle) end end addEvent("playTheSound", true) addEventHandler("playTheSound", root, playTheSound) function stopTheSound(x, y, z) stopSound(sound) end addEvent("stopTheSound", true) addEventHandler("stopTheSound", root, stopTheSound) -- 181 FM: [url=http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040]http://www.181.fm/winamp.pls?station=18 ... 0(Top%2040[/url])&file=181-power.pls -- The Hitz channel: [url=http://www.in.com/music/radio/977-the-hitz-channel-15.html]http://www.in.com/music/radio/977-the-h ... el-15.html[/url] Server: function createSpeaker(thePlayer) local x, y, z = getElementPosition(thePlayer) speakerObject = createObject(2229, x, y, z-4) outputChatBox("You have Succesfully created a speaker!", thePlayer, 0, 250, 0) if (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(speakerObject, vehicle) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else triggerClientEvent(root, "playTheSound", root, x, y, z) end end addCommandHandler("placespeaker", createSpeaker) function deleteSpeaker(thePlayer) if (isElement(speakerObject)) then destroyElement(speakerObject) outputChatBox("You have Succesfully destroyed the Speaker!", thePlayer, 0, 0, 255) triggerClientEvent("stopTheSound", root) else outputChatBox("Speaker is not created!", thePlayer, 250, 0, 0) end end addCommandHandler("destroyspeaker", deleteSpeaker)
denny199 Posted December 22, 2012 Posted December 22, 2012 Do you mean this:? CLICKME setSoundMaxDistance
DhrJay Posted December 22, 2012 Author Posted December 22, 2012 Do you mean this:? CLICKME setSoundMaxDistance YES! YES, I do! Nice! But how do I put this in the script?
AhmadQTR Posted December 22, 2012 Posted December 22, 2012 Do you mean this:? CLICKME setSoundMaxDistance YES! YES, I do! Nice! But how do I put this in the script? local url = "http://www.di.fm/mp3/hardstyle.pls" function playTheSound(x, y, z, vehicle) sound = playSound3D(url, x, y, z) setSoundMaxDistance (url,20) if (isElement(vehicle)) then attachElements(sound, vehicle) end end addEvent("playTheSound", true) addEventHandler("playTheSound", root, playTheSound) function stopTheSound(x, y, z) stopSound(sound) end addEvent("stopTheSound", true) addEventHandler("stopTheSound", root, stopTheSound) -- 181 FM: [url=http://www.181.fm/winamp.pls?station=18]http://www.181.fm/winamp.pls?station=18[/url] ... 0(Top%2040)&file=181-power.pls -- The Hitz channel: [url=http://www.in.com/music/radio/977-the-h]http://www.in.com/music/radio/977-the-h[/url] ... el-15.html Just change the 20 to any number you want.
DhrJay Posted December 22, 2012 Author Posted December 22, 2012 Do you mean this:? CLICKME setSoundMaxDistance YES! YES, I do! Nice! But how do I put this in the script? local url = "http://www.di.fm/mp3/hardstyle.pls" function playTheSound(x, y, z, vehicle) sound = playSound3D(url, x, y, z) setSoundMaxDistance (url,20) if (isElement(vehicle)) then attachElements(sound, vehicle) end end addEvent("playTheSound", true) addEventHandler("playTheSound", root, playTheSound) function stopTheSound(x, y, z) stopSound(sound) end addEvent("stopTheSound", true) addEventHandler("stopTheSound", root, stopTheSound) -- 181 FM: [url=http://www.181.fm/winamp.pls?station=18]http://www.181.fm/winamp.pls?station=18[/url] ... 0(Top%2040)&file=181-power.pls -- The Hitz channel: [url=http://www.in.com/music/radio/977-the-h]http://www.in.com/music/radio/977-the-h[/url] ... el-15.html Just change the 20 to any number you want. Thanks man! You rock!
DhrJay Posted December 22, 2012 Author Posted December 22, 2012 I changed it to 5000... Nothing really changed! Any ideas?
AhmadQTR Posted December 22, 2012 Posted December 22, 2012 I changed it to 5000... Nothing really changed! Any ideas? Because it have limits , i think.
denny199 Posted December 22, 2012 Posted December 22, 2012 Because it's wrong. Just change the 20 again btw ;p local url = "http://www.di.fm/mp3/hardstyle.pls" function playTheSound(x, y, z, vehicle) sound = playSound3D(url, x, y, z) setSoundMaxDistance (sound,20) -- use a element .. if (isElement(vehicle)) then attachElements(sound, vehicle) end end addEvent("playTheSound", true) addEventHandler("playTheSound", root, playTheSound) function stopTheSound(x, y, z) stopSound(sound) end addEvent("stopTheSound", true) addEventHandler("stopTheSound", root, stopTheSound) -- 181 FM: [url=http://www.181.fm/winamp.pls?station=18]http://www.181.fm/winamp.pls?station=18[/url] ... 0(Top%2040)&file=181-power.pls -- The Hitz channel: [url=http://www.in.com/music/radio/977-the-h]http://www.in.com/music/radio/977-the-h[/url] ... el-15.html
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