ID:2316687
 
(See the best response by MrStonedOne.)
Code:
    verb
Logins()
set hidden=1
if(!world_loaded||!src) return
if(src&&client)
if(!client)return
var/list/l = params2list(winget(src,"login.Username;login.Password","text"))
if(!client)return
var/name = l["login.Username.text"]
var/pass = l["login.Password.text"]

if(!client)return

if(!fexists("Players/[ckey]/[name].sav"))
alert(src,"No save file found","Invalid")
return

if(!client)return

var/savefile/F = new("Players/[src.ckey]/[name].sav")

var/list/S = new/list()
var/PasswordRight

F["Password"] >> PasswordRight
F["S"] >> S

if(!client)return

if(!name)
alert(src,"Please enter an account ID.","Invalid")
winset(src, "login.Username", "text-color=#000000;background-color=#B81717")
return
if(!pass)
alert(src,"Please enter a password.","Invalid")
winset(src, "login.Password", "text-color=#000000;background-color=#B81717")
return
if(pass!=PasswordRight)
winset(src, "login.Password", "text-color=#000000;background-color=#B81717")
return
else
winset(src, "login.Username", "text-color=#2DB817;background-color=#2DB817")
winset(src, "login.Password", "text-color=#2DB817;background-color=#2DB817")
defaultWindow("main")
src.client.LoadMob(S)


Problem description:

I'm getting bad client as a runtime error. Does anyone know how to fix this?
What is this verb under? mob?
Put this right below your 'set hidden=1' line and see what these values are.
world.log << "src=[src], usr=[usr], client=[client]"


Also, what line is giving you the error? This one?
                    src.client.LoadMob(S)
What's with all the if(!client) return lines? You already checked if the caller of the verb had a client once, and if they did, all that code would run. Setting a few variables and checking a savefile's existence isn't going to change their client at all.
Best response
They likely added them in attempt to figure out the runtime.

Ghost gaming, the bad client runtime is from the winset()s after alert(). alert sleeps the proc, and during sleeps the client can go away. the alerts and wingets should have an if (!client) check after them, the rest of the checks can go away.

Also, because everything you do here has to do with the client, this verb might be more appropriate on the client, not the mob.
What is happening to the src and the client. They go away before I can even login. Is there any way to prevent this?