Jump to content

Stop playSound3D music


DennisUni

Recommended Posts

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) 

Link to comment
  
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) 
  

Link to comment

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...