ID:167229
 
how do i make it so when i have music playing i can click a verb to stop the music. Heres my music code:

            Play()
set category = "Admin"
var/x=input("What song do you wish to play?","Songs")as null|anything in songs
if(x) usr<<sound(songs[x])





var/list/songs=list("Track1"='track01.wma',"Track2"='track02.wma',"Track3"='track03.wma',"Track4"='track04.wma',"Track5"='track05.wma',"Track6"='track06.wma',"Track9"='track09.wma',"Track10"='track10.wma',"Track11"='track11.wma',)



fyi this isnt my code but i forgot who gave it to me
heres how i fixed it

            Play()
set category = "Admin"
var/x=input("What song do you wish to play?","Songs")as null|anything in songs
if(x) usr<<sound(songs[x],channel=1)

Stop()
set category = "Admin"
usr<< sound(null,channel=1)

var/list/songs=list("Track1"='track01.wma',"Track2"='track02.wma',"Track3"='track03.wma',"Track4"='track04.wma',"Track5"='track05.wma',"Track6"='track06.wma',"Track9"='track09.wma',"Track10"='track10.wma',"Track11"='track11.wma',"Cancel")



if you didnt notice i desinated a channel for the songs to play on then I just made a stop verb and i made the stop verb. Then when clicked i made it make the song playing return null.