TheGrimReaper

[Help]3DRadio test

Recommended Posts

function noRadio()
    setRadioChannel(0)
    addEventHandler('onClientPlayerRadioSwitch', getRootElement(), function() cancelEvent() end )
end

function off()
stopSound(sound)
noRadio()
play1()
end
addEvent( "off", true )
addEventHandler( "off", localPlayer, play )

function play1()
noRadio()
stopSound(sound)
outputChatBox("Radio 1!!" )
local vehicle = getPedOccupiedVehicle(getLocalPlayer( ))
local x,y,z = getElementPosition( vehicle )
sound = playSound3D( "http://us3.internet-radio.com:8313/listen.pls", x, y, z)
setSoundMaxDistance( sound,50 )
attachElements ( sound, vehicle)
end
addEvent( "r1", true )
addEventHandler( "r1", localPlayer, play1 )

function play2()
noRadio()
stopSound(sound)
outputChatBox("Radio 2" )
local vehicle = getPedOccupiedVehicle(getLocalPlayer( ))
local x,y,z = getElementPosition( vehicle )
sound = playSound3D( "http://188.40.32.140:8061/listen.pls", x, y, z)
setSoundMaxDistance( sound,50 )
attachElements ( sound, vehicle)
end
addEvent( "r2", true )
addEventHandler( "r2", localPlayer, play2 )

function play3()
noRadio()
stopSound(sound)
outputChatBox("Radio 3")
local vehicle = getPedOccupiedVehicle(getLocalPlayer( ))
local x,y,z = getElementPosition( vehicle )
sound = playSound3D( "http://uk7.internet-radio.com:8040/listen.pls", x, y, z)
setSoundMaxDistance( sound,50 )
attachElements ( sound, vehicle)
end
addEvent( "r3", true )
addEventHandler( "r3", localPlayer, play3 )

function play4()
noRadio()
stopSound(sound)
outputChatBox("Radio 4!!" )
local vehicle = getPedOccupiedVehicle(getLocalPlayer( ))
local x,y,z = getElementPosition( vehicle )
sound = playSound3D( "http://83.142.226.45:25700/listen.pls", x, y, z)
setSoundMaxDistance( sound,50 )
attachElements ( sound, vehicle)
end
addEvent( "r4", true )
addEventHandler( "r4", localPlayer, play4 )

how can i stop sound only for me without stopping others sound?? like when i switch radio station it stops "sound" which stops everyones

 

Share this post


Link to post
Posted (edited)

nevermind i got it , i had to get attached elements  and destroy the sound  element :)

Close topic :)

note : there is a copy pasting error in the off function :V ,

 

 

Edited by TheGrimReaper

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.