Jump to content

مساعدة في playSound


Recommended Posts

السلام عليكم ..

في مشكلة عندي 
ال Sound = بتشتغل  تمام 
ولكن لما اكتب stopsound 
ما تتوقف 
 

--DeBug
Bad argument @ 'stopSound' [Expected sound at argument 1, got nil]
--This_Code_Client
addEventHandler("onClientResourceStart",getRootElement(),
function ()
    local sounds = playSound("song.mp3")
	setSoundVolume(sounds, 0.5)
end)

function stop ( )
stopSound( sounds )
end
addCommandHandler("stopsound",stop)

 

Link to comment
addEventHandler("onClientResourceStart",getRootElement(),

function ()
sounds = playSound("song.mp3")
setSoundVolume(sounds, 0.5)
end
)



function stop ( )
if isElement(sounds) then 
stopSound(sounds)

end
end
addCommandHandler("stopsound",stop)

 

Link to comment
13 hours ago, #TeKa said:

السلام عليكم ..

في مشكلة عندي 
ال Sound = بتشتغل  تمام 
ولكن لما اكتب stopsound 
ما تتوقف 
 


--DeBug
Bad argument @ 'stopSound' [Expected sound at argument 1, got nil]

--This_Code_Client
addEventHandler("onClientResourceStart",getRootElement(),
function ()
    local sounds = playSound("song.mp3")
	setSoundVolume(sounds, 0.5)
end)

function stop ( )
stopSound( sounds )
end
addCommandHandler("stopsound",stop)

 

جرب :
 

-- Client
addEventHandler("onClientResourceStart",resourceRoot,
function ()
    sounds = playSound("song.mp3")
	setSoundVolume(sounds, 0.5)
end
)

function stop ( )
stopSound ( sounds )
end
addCommandHandler("stopsound",stop)

 

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