ID:149854
 
I am having major problems with players being saved as variables within other players upon logout. For example: Player A is saved in Player B when B logs out. When Player B logs back in, if A is in the game, they automatically leave then rejoin the world and their character is restored to what they were when Player B logged out. This "Back in Time/Autolog" bug is causing some pretty major problems.

I don't store players as a variable in other users on purpose, but what I found was happening was that if a player was running a proc with another player being "src" or "M"(var/mob/M that I use in for loops) in that proc then they would be saved within that player upon logout. To fix this, I made it so that M is set to null when someone logs out. However, there are still occasional occurances of this bug within my game. I have no idea what is causing them, so I have two questions:

1. What could theother variables storing players be?

2. Is there anyway to scan a user's vars for any variable that contains another mob or player and then set that variable to null? I've tried a million different methods, and none of them seem to work.

Thanks
SilkWizard wrote:
I don't store players as a variable in other users on purpose, but what I found was happening was that if a player was running a proc with another player being "src" or "M"(var/mob/M that I use in for loops) in that proc then they would be saved within that player upon logout. To fix this, I made it so that M is set to null when someone logs out.

This is hard to understand, unless M is a non-tmp variable of the mob (not just a variable in a function). Is M part of the mob?

2. Is there anyway to scan a user's vars for any variable that contains another mob or player and then set that variable to null? I've tried a million different methods, and none of them seem to work.

The best thing to do is look through all your mob variables and set any that don't need to be saved to be tmp, like so:

mob/player
var/tmp
mob/other_mob
list/group

Etc.
In response to Deadron
Thanks Deadron-I didn't even consider making most of the mob's variables temporary...kind of sad considering I've been coding for months now.