EDIT: It has something to do with my savefiles:
client/New()
..()
if(banned.Find(src.key) || banned.Find(src.address))
del src
var/savefile/F = new("players/[src.key]/save.sav")
if(!isnull(F["save"]))
F["save"] >> src.mob
ID:161148
![]() Jun 11 2008, 3:03 pm
|
|
I have it so that when a player logs in, it says "[src] has joined the game." However, my game displays that message three times. I have one client/New(), one mob/Login(), and can't for the life of me figure out where the extra 2 messages are coming from. I would've posted this in Code Problems, but I can't pinpoint the code.
EDIT: It has something to do with my savefiles: client/New() |
![]() Jun 11 2008, 3:06 pm
|
|
Changing the client's mob calls Login() for that mob. Is that what you're doing?
|
Hit ctrl+F, then search for "[src] has joined the game." in all the files. You should also only have one in client/New().
Edit: Like I said before, just remove it from mob/Login(). |
Would reordering my code fix it? Trying it now...
EDIT: Reordering got rid of one of them. Still got one extra, though... |
The game is doing exactly what it's supposed to. It's calling client/New(), attaching a mob via the ..() proc as it does, and then loading a save file and attaching it to a client. So what you've got is two Login calls, which is probably where your duplicate message is coming from.
|
I tried putting the ..() under an else statement, and still got 2 messages. Also, if I take that line out completely, I still get an extra message.
|
If I delete the saves, it displays one message. When loading an existing file, it shows 2. Good question.
|
Seraphrevan wrote:
If I delete the saves, it displays one message. When loading an existing file, it shows 2. Good question. Problem solved :P now you just need to think of the best possible way of doing it. |
Okay then. So the problem seems to be what I suspected. Really, though, you should be putting the log in message on client/New(), anyway, since that's when someone actually connects to the game world.
|