SA-MP Forums Archive
stats mixing up - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: stats mixing up (/showthread.php?tid=264271)



stats mixing up - bartje01 - 25.06.2011

Hey everyone. My stats are mixing up with players. So when someone's age is 20 someone else's age will be be stted to 20 as well. What's wrong?

pawn Код:
if (dialogid == LOGIN)
    {
        format(file, sizeof(file), SERVER_USER_FILE, Name);
        if(!response) return Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp)
        {
            SendClientMessage(playerid, COLOR_GREY, "This password doesn't match with your account.");
            ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
            PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
            PlayerInfo[playerid][pGender] = dini_Int(file, "Gender");
            PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
            PlayerInfo[playerid][pNationality] = dini_Int(file, "Nationality");
            SendClientMessage(playerid,COLOR_ORANGE, "Successfully logged in!");
            SpawnPlayer(playerid);
            SetCameraBehindPlayer(playerid);
            SetTimer("SaveStats", 1000, true);
            SetTimerEx("SpawnTimer",50,0,"d",playerid);
        }
        return 1;
    }
pawn Код:
public SaveStats(playerid)
{
   
    GetPlayerName(playerid, Name, sizeof Name);
    format(file, sizeof file, SERVER_USER_FILE, Name);
    dini_IntSet(file, "Money", GetPlayerMoney(playerid));
    dini_IntSet(file, "Score", GetPlayerScore(playerid));
    dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
    SetPlayerMoney(playerid,PlayerInfo[playerid][pCash]);
    SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
    return 1;
}



Re: stats mixing up - alpha500delta - 25.06.2011

Well at the LOGIN dialog you didn't use GetPlayerName, maybe that's the problem?

It might also be a problem in the SERVER_USER_FILE being wrongly configured (like %f.ini instead %s or %d.ini) but I doubt that.