mob
Login()
switch(input("What team would you like to join?(Requires GM approval)",text) in list ("blue","red"))
if("blue")
for(var/mob/M in world)
if(M.GM == 1)
switch(input(M,"[src] wants to join blue team. agree?",text) in list ("yes","no"))
if("yes")
src.team = "blue"
src.overlays += 'blueover.dmi'
switch(input("What task force do you want?",text) in list ("delta force","SAS","korean special force"))
if("delta force")
src.icon = 'Delta force.dmi'
if("SAS")
src.icon = 'SAS.dmi'
if("korean special force")
src.icon = 'KSF.dmi'
switch(input("ready?",text) in list ("yes","no"))
if("yes")
if(src.team == "blue")
src.loc = locate(1,1,1)
usr.overlays += 'blueover.dmi'
else
src.loc = locate(1,70,1)
src.overlays += 'redover.dmi'
if("no")
src<<"[M] declined! try joining the other team!"
return
if("red")
for(var/mob/M in world)
if(M.GM == 1)
switch(input(M,"[src] wants to join red team. agree?",text) in list ("yes","no"))
if("yes")
src.team = "red"
src.overlays += 'redover.dmi'
switch(input("What task force do you want?",text) in list ("delta force","SAS","korean special force"))
if("delta force")
src.icon = 'Delta force.dmi'
if("SAS")
src.icon = 'SAS.dmi'
if("korean special force")
src.icon = 'KSF.dmi'
switch(input("ready?",text) in list ("yes","no"))
if("yes")
if(src.team == "blue")
src.loc = locate(1,1,1)
src.overlays += 'blueover.dmi'
else
src.loc = locate(1,70,1)
src.overlays += 'redover.dmi'
if("no")
src<<"[M] declined! try joining the other team!"
return
Problem description:
i know there is a problem with this code... but i cant find it. in game, when i choose a team i get runtime error.
runtime error: bad client
proc name: Login (/mob/Login)
source file: main.dm,7
usr: Gogeta126 (/mob)
src: Gogeta126 (/mob)
call stack:
Gogeta126 (/mob): Login()
and nothing happens afterwards
Second, this proc is chock full of usr abuse. You should be using src in Login(), not usr because it isn't safe.
As for the particular error you have, "bad client" comes up when you're trying to use input(), alert(), etc. on a mob that has no client. So in this case, a GM mob has been found, only the GM happens not to be online. The code is trying to ask a dead husk for permission and when it realizes no one is really there to ask, it throws the error.
Lummox JR