In response to Garthor
Sorry Here
mob/radio/verb
Music(S as sound)
set category = "Radio"
if(file("[S].mid"))
for(var/mob/M in world)
M.musicplaying=1
world<<"Radio:Everyone this is your ZZ DJ,[usr] Just Told me they want us to play a song called [S]!"
sleep(10)
world << sound(S,1)
world << "<B>You Start To Dance!"
usr.verbs-=new/mob/radio/verb/Music()
src.verbs-=new/mob/radio/verb/Music()
M.verbs-=new/mob/radio/verb/Music()
sleep(3000)
for(var/mob/M in world)
M.musicplaying=0
else
usr<<"DJ: No Way I hate Wav Files You can only play midi's here! Do it again and ill restrict your Radio Card!"
world << sound(null)
usr.verbs-=new/mob/radio/verb/Music()
In response to Vash_616
Oh come on can someone please help me? ive been waiting for ever.
In response to Vash_616
Dont beg?
In response to Vash_616
Vash_616 wrote:
Sorry Here
> 
> mob/radio/verb
> Music(S as sound)
> set category = "Radio"
> if(file("[S].mid"))
> for(var/mob/M in world)
> M.musicplaying=1
> world<<"Radio:Everyone this is your ZZ DJ,[usr] Just Told me they want us to play a song called [S]!"
> sleep(10)
> world << sound(S,1)
> world << "<B>You Start To Dance!"
> usr.verbs-=new/mob/radio/verb/Music()
> src.verbs-=new/mob/radio/verb/Music()
> M.verbs-=new/mob/radio/verb/Music()
> sleep(3000)
> for(var/mob/M in world)
> M.musicplaying=0
> else
> usr<<"DJ: No Way I hate Wav Files You can only play midi's here! Do it again and ill restrict your Radio Card!"
> world << sound(null)
> usr.verbs-=new/mob/radio/verb/Music()
>
>


Working code:

mob/radio/verb
Music(S as sound)
set category = "Radio"
if(file("[S].mid"))
for(var/mob/M in world)
M.musicplaying=1
world<<"Radio:Everyone this is your ZZ DJ,[usr] Just Told me they want us to play a song called [S]!"
spawn(10)
world << sound(S,1)
world << "<B>You Start To Dance!"
usr.verbs-=new/mob/radio/verb/Music()
src.verbs-=new/mob/radio/verb/Music()
M.verbs-=new/mob/radio/verb/Music()
spawn(3000) M.musicplaying=0
else
usr<<"DJ: No Way I hate Wav Files You can only play midi's here! Do it again and ill restrict your Radio Card!"
world << sound(null)
usr.verbs-=new/mob/radio/verb/Music()


Where is musicplaying variable used in actually?
In response to PBYOND
mob
DJ
noattack=1
density=1
verb
Request()
set src in oview(1)
set category = "Radio"
if(usr.gotradio == 0)
usr<<"DJ: Sorry man i only let people use my radio who have a radio access card like joey!"
if(usr.musicplaying == 1)
usr<<"DJ: Can You wait a few Mins?"
usr.verbs-=new/mob/radio/verb/Music()
if(usr.gotradio == 1)
usr.verbs+=new/mob/radio/verb/Music()
usr<<"DJ: Hurry and pick a song"



mob/radio/verb
Music(S as sound)
set category = "Radio"
if(file("[S].mid"))
for(var/mob/M in world)
M.musicplaying=1
world<<"Radio:Everyone this is your ZZ DJ,[usr] Just Told me they want us to play a song called [S]!"
spawn(10)
world << sound(S,1)
world << "<B>You Start To Dance!"
usr.verbs-=new/mob/radio/verb/Music()
src.verbs-=new/mob/radio/verb/Music()
M.verbs-=new/mob/radio/verb/Music()
spawn(3000) M.musicplaying=0
else
usr<<"DJ: No Way I hate Wav Files You can only play midi's here! Do it again and ill restrict your Radio Card!"
world << sound(null)
usr.verbs-=new/mob/radio/verb/Music()


the problem is that you can still play a song while another one is playing. and i dont want that
In response to Vash_616
mob
DJ
noattack=1
density=1
verb
Request()
set src in oview(1)
set category = "Radio"
if(usr.gotradio == 0)
usr<<"DJ: Sorry man i only let people use my radio who have a radio access card like joey!"
if(usr.musicplaying == 1)
usr<<"DJ: Can You wait a few Mins?"
usr.verbs-=new/mob/radio/verb/Music()
if(usr.gotradio == 1)
usr.verbs+=new/mob/radio/verb/Music()
usr<<"DJ: Hurry and pick a song"


Let me guess, when you run it, it says:
"DJ: Can You wait a few Mins?
DJ: Hurry and pick a song"
and then lets you pick?

It's because, you are saying "If music is playing, take away verb and tell them 'bla bla', then, if they have a radio, add the verb, and tell them 'blabla'"

Firstly, change all "if(blabla==1)" to "if(blabla)" and all "if(blabla==0)" to "if(!blabla)".

Then, change your "if(usr.gotradio)" to "if(usr.gotradio && !usr.musicplaying)"

That should work.

~Ease~
In response to Ease
mob
DJ
noattack=1
density=1
verb
Request() //When someone clicks request
set src in oview(1) //And they are whitin one tile of "DJ"
set category = "Radio" //They can click it in the "Radio" category.
if(!usr.gotradio) //If you don't have the radio card.
usr<<"DJ: Sorry man, I can only allow you to request songs if you have one of them radio cards like Joey does."
return
else //If you do.
if(musicplaying) //If there already is a song playing
usr<<"DJ: Could you wait a few minutes? A song is already playing!"
return
var/S = input("Hurry up and select your song!") as sound|null
if(findtext("[S]",".mid"))
usr<<"DJ: Good...it's a MID."
else//Only accepts .MID files.
usr<<"DJ: I will not accept a song that isn't a MID! Get lost!"
return
var/X = length(S)
if(X >= 1000000) //If the file is over 1 MB.
usr<<"DJ: Your song here exceeds one megabyte, it will cause immidiate lag to other players online, and I don't want that happening, you got it?"
return
var/Y = input("Give me an amount of time (in seconds) in which the song ends, then I will turn the protection off.") as num|null
var/P = Y * 10 //Make the value 'P' the same as Y, but add a zero (so it becomes milliseconds, which BYOND uses in sleep() and spawn() procs)
if(P> 2400) //If the newly aquired milliseconds go past 2400 (240 seconds / equal to 4 minutes)
usr<<"DJ: The amount of time may not go over four minutes!"
musicplaying=1 //Turn the protection on, so nobody can play another song.
world << sound(S,0) //Play the song once.
spawn(P) //Wait the specificed time.
musicplaying=0 //Turn the protection off.
Vote_for_protection_off()
set src in oview(1)
set category = "Radio"
if(musicplaying)
usr.votepo=1
world << "[usr] has voted for the protection of the radio to be turned off!"
if(!voteprocess) voteprocess()
else return 0
mob/var
gotradio=0
noattack=0
votepo=0
var/musicplaying=0
var/voteprocess=0
proc/voteprocess()
voteprocess=1
sleep(6000)
if(!musicplaying) return //If it has been changed during this time, do not continue.
var/yes=0
var/no=0
for(var/mob/M in world)
if(M.votepo) yes+=1
else no+=1
if(yes==no)
world << "Vote Results: [yes] said yes, [no] said no - Declaration: Equal - No changes will be made."
else if(yes>no)
world << "Vote Results: [yes] said yes, [no] said no - Declaration: Yes - Protection will be removed."
musicplaying=0
else
world << "Vote Results: [yes] said yes, [no] said no - Declaration: No - No changes will be made."
voteprocess=0

That oughta do it!
In response to PBYOND
PBYOND wrote:
> mob
> DJ
> noattack=1
> density=1
> verb
> Request() //When someone clicks request
> set src in oview(1) //And they are whitin one tile of "DJ"
> set category = "Radio" //They can click it in the "Radio" category.
> if(!usr.gotradio) //If you don't have the radio card.
> usr<<"DJ: Sorry man, I can only allow you to request songs if you have one of them radio cards like Joey does."
> return
> else //If you do.
> if(musicplaying) //If there already is a song playing
> usr<<"DJ: Could you wait a few minutes? A song is already playing!"
> return
> var/S = input("Hurry up and select your song!") as sound|null
> if(findtext("[S]",".mid"))
> usr<<"DJ: Good...it's a MID."
> else//Only accepts .MID files.
> usr<<"DJ: I will not accept a song that isn't a MID! Get lost!"
> return
> var/X = length(S)
> if(X >= 1000000) //If the file is over 1 MB.
> usr<<"DJ: Your song here exceeds one megabyte, it will cause immidiate lag to other players online, and I don't want that happening, you got it?"
> return
> var/Y = input("Give me an amount of time (in seconds) in which the song ends, then I will turn the protection off.") as num|null
> var/P = Y * 10 //Make the value 'P' the same as Y, but add a zero (so it becomes milliseconds, which BYOND uses in sleep() and spawn() procs)
> if(P> 2400) //If the newly aquired milliseconds go past 2400 (240 seconds / equal to 4 minutes)
> usr<<"DJ: The amount of time may not go over four minutes!"
> musicplaying=1 //Turn the protection on, so nobody can play another song.
> world << sound(S,0) //Play the song once.
> spawn(P) //Wait the specificed time.
> musicplaying=0 //Turn the protection off.
> Vote_for_protection_off()
> set src in oview(1)
> set category = "Radio"
> if(musicplaying)
> usr.votepo=1
> world << "[usr] has voted for the protection of the radio to be turned off!"
> if(!voteprocess) voteprocess()
> else return 0
> mob/var
> gotradio=0
> noattack=0
> votepo=0
> var/musicplaying=0
> var/voteprocess=0
> proc/voteprocess()
> voteprocess=1
> sleep(6000)
> if(!musicplaying) return //If it has been changed during this time, do not continue.
> var/yes=0
> var/no=0
> for(var/mob/M in world)
> if(M.votepo) yes+=1
> else no+=1
> if(yes==no)
> world << "Vote Results: [yes] said yes, [no] said no - Declaration: Equal - No changes will be made."
> else if(yes>no)
> world << "Vote Results: [yes] said yes, [no] said no - Declaration: Yes - Protection will be removed."
> musicplaying=0
> else
> world << "Vote Results: [yes] said yes, [no] said no - Declaration: No - No changes will be made."
> voteprocess=0
>

That oughta do it!

it works but.. it does not stop another user from playing a song and the vote protection off does not work :) i wont complain ill try to mess with it,thank you alot pbyond
Page: 1 2