ID:747435
 
(See the best response by .screw.)
Code:
Send_Invites()
for(var/mob/M in world)
var/mob/M
if(CustAlert(M,"A tournament has been started, would you like to join?",list("Join","Cancel"),0,10,5,12))
if("Join")
if(Tournament==0)
M<<"There isn't a tournament going on!"
else
Entries.Add(M)
M.tourny=1
M<<"You entered the tournament!"
world<<"<B><font color=red>Announcement:</font>[M] has joined the tournament!</b>"
M.loc=locate(186,18,13)
M.STM=M.MaxSTM
if("Cancel")
M<<"Ok, maybe you can join next time!"
return


Problem description:

What i'm trying to do is make it to where it sends everyone who is in the game that alert to ask them if they would want to join the tournament or not. I can get it to send, but A/ it sends it to the last person who logs in, and B/ if they press cancel, it ends the entire string, meaning that noone else gets the alert, if they do however press Join, then it sends it to the next person so please help me out... after i get this fixed i will have a fully working tournament system

Best response
You probably need to display the code within CustAlert()

Based upon the current code, you need to tab everything under for(var/mob/M in world) over once and var/mob/M is not needed.

It sounds like CustAlert() holds everything up. Add a spawn() to allow the for() loop to continue. Something similar to the following:
for(var/mob/M in world)
spawn()
if(...)
that seems to have fixed it, thanks .screw, though i wont know till i can host when i get home as i cant do it here in school. so i might be back, but till then... if then happens~, thanks ^.^
In response to Leoinpharoh
Leoinpharoh wrote:
that seems to have fixed it, thanks .screw, though i wont know till i can host when i get home as i cant do it here in school. so i might be back, but till then... if then happens~, thanks ^.^

Side note: It would probably make more sense to do the following:
        Send_Invites()
// clients only
for(var/client/C)
spawn switch(input(C.mob, "A tournament has been started, would you like to join?", "Tournament") in list("Join", "Cancel"))
if("Join")
// stuff here
if("Cancel")
// stuff here
// do not return!


In your code, you use return, thus breaking the loop when someone presses cancel.