I am having trouble with logging in and out, I've tried everything I can think of, looked through the forums etc. but I still cannot figure out how to fix this. When people log in in my game, instead of saying "*name* has logged in", it says "*name* has logged out.", and when people log out, it doesn't say anything and their icon does not disappear. Here is the code I am using:
world
mob = /mob/creating_character
mob/creating_character
var/mob/new_mob
Login()
spawn()
src.CreateCharacter()
world << "[usr.name] has logged in."
proc/CreateCharacter()
var/mob/new_mob
new_mob = new /mob/players/Main_char()
var/turf/newloc = locate(rand(98,102),rand(98,102),5)
new_mob.Move(newloc)
new_mob.name = usr.name
src.client.mob = new_mob
del(src)
Logout()
world << "[usr.name] has logged out."
del(src)
..()
If you see what is wrong please reply.
ID:149036
Jul 22 2002, 10:47 pm
|
|
Jul 22 2002, 11:25 pm
|
|
The problem you're having is because Logout() is called for one mob and Login() for the new one whenever your player switches mobs, which is happening at the end of the character creation process. The solution is to move Logout() to mob/Logout(), and make mob/creating_character/Logout() override that to do nothing. mob/Login() can then announce that someone has entered the game as such and such a character, while mob/creating_character/Login() says they've just logged in and handles all the character creation stuff.
Lummox JR |