ID:1525715
 
Code:
mob/verb/Respawn()
if(dead)
if(key == "Vivalas")
var/mob/admin/A = new(locate(1,1,1))
A.res = 1
client.mob = A

mob
var/tmp/res




mob/Login()
if(loc&&!res)
usr << "Welcome back to the game!"
world << "\bold [usr.key] has reconnected!"

if(res)
res = 0
return

else
usr.loc = locate(1,1,1)
world << "\bold [usr] has joined the game!"

mob/Logout()
if(!res)
world << "\bold [usr.key] has left the game! :("


Problem description:
Well, I am excited because I am about ready to run my game's first stress test. I am working on a respawn system, and tried doing a input() system, but failed. I want the player to be able to observe his death area as long as hew wants until he decides to respawn. My only snag is when the player respawns it runs the login/logout things. I tried to combat this with the tmp var res, and it got rid of the login message, but it didn't fix the logout message.
And I didn;t do the second half of the respawn verb yet, for regular players. I intend to add a list of admins, and later on a .txt file so please don't nag me about that.
These are also snippets of the code involved, they aren't arranged like this.
Login() happens when a client is attached to a mob, and Logout() is called when a client leaves a mob. Since you are creating a new mob, you are logging out of the old mob, and logging in to the new one.
I am confused though, I would think that the Login() message would be the one showing and not the Logout() message, as the variables would be reset
You did not change the old mob's res var, so it still has res = 0 when the client logs out of it.
Okay so the client is destroyed for Logout(), which I should of figured out earlier, by changing the res var to be attached to the client. Would it be wise to use client and New() or Del() to achieve this? Or would that bring problems of their own?
Thanks I fixed it, my last post was after yours.