First of all, as you see, you are loading it via PVars, while you earlier used normal variables.
Second, you are using "pLevel" and "pExp" to load the variables, while using "level" and "Exp" to save them.
This way you will save everything with "pLevel" and "pExp" and loading from unsigned names.
I'd suggest you to use one type of var, and also put the same names when loading and saving data:
pawn Код:
public OnPlayerLogin(playerid,password[])
{
if(GetPVarInt(playerid, "PlayerLogged") != 0) return true;
new string[128];
format(string, sizeof(string), "users/%s.ini", PlayerName(playerid));
Hash(password);
if(strcmp(DOF2_GetString(string, "Key"), password, true) == 0)
{
if(DOF2_GetInt(string, "Convert") != 5) return Kick(playerid);
// Load Ints //
SetPVarInt(playerid, "Level", DOF2_GetInt(string, "pLevel"));
SetPVarInt(playerid, "Exp", DOF2_GetInt(string, "pExp"));
new score = PlayerInfo[playerid][pLevel];
SetPlayerScore(playerid, score);
}
}
public OnPlayerDataSave(playerid)
{
if(IsPlayerConnected(playerid) && GetPVarInt(playerid, "PlayerLogged") == 1)
{
new string[128];
format(string, sizeof(string), "users/%s.ini", PlayerName(playerid));
if(DOF2_FileExists(string))
{
DOF2_SetInt(string, "pLevel", GetPVarInt(playerid, "Level"));
DOF2_SetInt(string, "pExp", GetPVarInt(playerid, "Exp"));
}
return 0;
}
}