ID:141130
 
Code:
    verb
HostTournament()
set name = "Host Tournament"
set category = "Tournament"
if(istourney==0)
world << "[src.name] has hosted a Tournament!"
src.verbs += /mob/verb/EnterTournament (I know this is wrong)
src.verbs += /mob/verb/LeaveTournament (I know this is wrong)
istourney = 1
else
usr << "A tournament is already being hosted!"

FinishTournament()
set name = "Finish Tournament"
set category = "Tournament"
if(istourney==1)
var/tourneywinner = input("Who was the winner?")
world << "Tournament has finished! The winner was [tourneywinner]!"
src.verbs -= /mob/verb/EnterTournament (I know this is wrong)
src.verbs -= /mob/verb/LeaveTournament (I know this is wrong)
istourney = 0
else
usr << "No tournament is being hosted!"


Problem description:
How would I go about about making it so that when a GM hosts a tourney using the HostTournament verb, everyone in the world will get two new verbs "Join Tournament" and "Leave Tournament", I already have the codes for these two verbs but I just need to the code required to to give the two verbs to the world when a tournament is hosted and then take them away when the tournament is finished, get it?

obj/tournament
verb
join()
set src in world
world << "[usr] joins [src]"
leave()
set src in world
world << "[usr] leaves [src]"

mob/verb/create_tournament()
var/obj/tournament/T = new(locate(1,1,1))
T.name = "[name]'s Tournament"


Note that the tournament obj has to be somewhere on the map in order for the verbs to be accessible (and also for it to not be deleted by the garbage collector)
In response to Garthor
Heh, that's a nice alternative, very quick & dirty solution. I dunno if I'd do that though. What's for sure is that I wouldn't put the obj on the map, you can just give objects that you don't want to be garbage collected a tag (and all atoms in existence are in world.contents, irregardless of their being on the map or not).
In response to Kaioken
Actually, now that I fiddle around with it, there's a major problem with using "set src in world", which is that the client doesn't seem to actually load the obj to be able to use its verbs, unless it can see it or the obj is explicitly output (world << T).

Too clever by half, it would seem.
In response to Garthor
I tried your code Garthor but when I host a tournament using your verb nothing happens and everyone has the join/leave verbs regardless if a tournament is hosted it not. (Sorry I'm new to coding, REALLY new.)
In response to COnfuesSHhg
I found out a simple way of doing it:

HostTournament()
set name = "Host Tournament"
set category = "Tournament"
if(istourney==0)
world << "<font size=+2><FONT COLOR=red><b>[src.name] has hosted a Tournament!</FONT><FONT COLOR=yellow> Click 'Enter Tournament' in the Tournament tab to join!</b></FONT></font>"
for(var/mob/F in world)
F.verbs += /mob/Tournament/verb/EnterTournament
F.verbs += /mob/Tournament/verb/LeaveTournament
istourney = 1
src.loc = locate(52,39,13)
else
usr << "<b>Error:</b> A tournament is already being hosted!"

FinishTournamentEntry()
set name = "Close Tournament Entry"
set category = "Tournament"
if(istourney==1)
world << "<font size=+2><FONT COLOR=yellow><b>Tournament entry is now closed!</b></FONT></font>"
for(var/mob/F in world)
src.verbs -= /mob/Tournament/verb/EnterTournament
src.verbs -= /mob/Tournament/verb/LeaveTournament
else
usr << "<b>Error:</b> No tournament is being hosted!"

FinishTournament()
set name = "Finish Tournament"
set category = "Tournament"
if(istourney==1)
var/tourneywinner = input("Who was the winner?")
world << "<font size=+2><FONT COLOR=red><b>Tournament has finished!</FONT><FONT COLOR=yellow> The winner was [tourneywinner]!</b></FONT></font>"
src.verbs -= /mob/Tournament/verb/EnterTournament
src.verbs -= /mob/Tournament/verb/LeaveTournament // Just incase they close tourney without finishing the entry.
istourney = 0
else
usr << "<b>Error:</b> No tournament is being hosted!"


Thanks for your help guys anyways. :P