Jump to content

Stop playSound3D music


DennisUni

Recommended Posts

Posted

Not giving you any other code, but this is the one fixed.

As SDK said, check out the Wiki's stopSound client function.

local streamURL = "http://www.true.nl/streams/slamfmlivestream.pls" 
local radius = 150 
local volume = 1.0 
  
function radio3d() 
    local x, y, z = getElementPosition(localPlayer) 
    local sound = playSound3D(streamURL, x, y, z, true) 
    setSoundVolume(radio, volume) 
    setSoundMaxDistance(radio, radius) 
end 
addCommandHandler("staffradio", radio3d) 

Posted
  
local streamURL = "http://www.true.nl/streams/slamfmlivestream.pls" 
local radius = 150 
local volume = 1.0 
local s = false 
  
function radio3d() 
if s then stopSound(sound) s = false return end 
    s = true 
    local x, y, z = getElementPosition(localPlayer) 
    local sound = playSound3D(streamURL, x, y, z, true) 
    setSoundVolume(sound , volume) 
    setSoundMaxDistance(sound , radius) 
end 
addCommandHandler("staffradio", radio3d) 
  

Posted

Thanks that works, i made i gui on it now so all works great.

But i have one more question, where can i find info about attach the radio to a vehicle when player is in a vehicle?

Posted

Thanks for your help! I have it working now.

I trigger the serverside event, and via there i start the 3DSound client side, so now all users hear it and not only me.

Script is completed now! 8)

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.
×
×
  • Create New...