Saving
#1

When a player disconnects from my server then reconnects his stats all go to 0 except his password and level and he also spawns in BlueBerry not where he logged off, why?

Код:
public OnPlayerDisconnect(playerid, reason)
{
   	new INI:File = INI_Open( user_account_path ( playerid ) );
   	INI_SetTag(File, "statistics" );
   	INI_WriteInt(File, "Level", GetPlayerScore( playerid ) );
   	INI_WriteInt(File, "Admin", PlayerInfo[ playerid ][ pAdmin ]);
   	INI_WriteInt(File, "RespectPoints", PlayerInfo[ playerid ][ pConnectTime ]);
	INI_WriteInt(File, "Registered", PlayerInfo[ playerid ][ pReg ]);
	INI_WriteInt(File, "Gender", PlayerInfo[ playerid ][ pSex ]);
	INI_WriteInt(File, "Age", PlayerInfo[ playerid ][ pAge ]);
	INI_WriteInt(File, "Cash", PlayerInfo[ playerid ][ pCash ]);
	INI_WriteInt(File, "Tutorial", PlayerInfo[ playerid ][ pTut ]);
	INI_WriteInt(File, "Job", PlayerInfo[ playerid ][ pJob ]);
	INI_WriteInt(File, "Tutorial", Tutorial[playerid]);
	INI_Close(File);
	Tutorial[playerid] = 0;
        }
        return 1;
}
Reply
#2

Could you show your loading code?
Reply
#3

Код:
@load_user_statistics(playerid, name[], value[])
{
    INI_String("Password", PlayerInfo[ playerid ][ pKey ], 129);
    INI_Int("Level", PlayerInfo[ playerid ][ pLevel ]);
    INI_Int("Admin", PlayerInfo[ playerid ][ pAdmin ]);
    INI_Int("RespectPoints", PlayerInfo[ playerid ][ pConnectTime ]);
	INI_Int("Registered", PlayerInfo[ playerid ][ pReg ]);
	INI_Int("Gender", PlayerInfo[ playerid ][ pSex ]);
	INI_Int("Age", PlayerInfo[ playerid ][ pAge ]);
	INI_Int("Cash", PlayerInfo[ playerid ][ pCash ]);
	INI_Int("Tutorial", PlayerInfo[ playerid ][ pTut ]);
	INI_Int("Job", PlayerInfo[ playerid ][ pJob ]);
    return 1;
}
Reply
#4

Any suggestions?
Reply
#5

Your loading and saving is correct, so somewhere between @load_user_statistics and checking those values you probably reset those variables. Check rest of your login handler (I guess you read the file there), and everything up to spawn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)