[Problema] Cargado de cuentas
#1

Bueno, desde que hosteй mi servidor estamos teniendo un problema muy raro con lo del guardado de cuentas y eso. Cuando un jugador se registra y luego vuelve a loguear, es como si en vez de cargar los datos de su cuenta se cargasen los de la mнa.

Por ejemplo, cuando miro mis stats dentro del juego yo tengo los kills y deaths del otro jugador, y el otro jugador tiene los mнos, y ademбs le da nivel 5 de admin y nivel 2 de vip (wtf) cuando se registra una nueva cuenta.

Aquн el registro y cargado de las cuentas:

pawn Код:
// En OnPlayerConnect
if(INI_Exists(Path(playerid)))
    {
        INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{98FB98}Log in your account", "This account is already regsitered in our database. Please enter your password to login and load your stats.\nPlease enter the correct password. Repeated attempts will get you kicked.", "Login", "Kick");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{98FB98}Register a new account", "This account is not registered. Please enter your password to register an account.", "Register", "Kick");
        return 1;
    }
pawn Код:
// En OnDialogResponse

case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Please enter your password to register", "Register", "Quit");
                    return 1;
                }
                new hash[129];
                WP_Hash(hash, sizeof(hash), inputtext);
                new INI:file = INI_Open(Path(playerid));
                INI_WriteString(file, "Password", hash);
                INI_WriteInt(file, "AdminLevel", 0);
                INI_WriteInt(file, "Money", 0);
                INI_WriteInt(file, "Score", 0);
                INI_WriteInt(file, "Muted", 0);
                INI_WriteInt(file, "Frozen", 0);
                INI_WriteInt(file, "Warnings", 0);
                INI_WriteInt(file, "Duty", 0);
                INI_WriteInt(file, "NoPM", 0);
                INI_WriteInt(file, "Kills", 0);
                INI_WriteInt(file, "Deaths", 0);
                INI_WriteInt(file, "VIP", 0);
                INI_WriteInt(file, "ToggleShop", 0);
                INI_Close(file);
                RepeatedAttempts[playerid] = 0;
                return 1;
            }
        }
        case DIALOG_LOGIN:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                new hash[129];
                WP_Hash(hash, sizeof(hash), inputtext);
                if(!strcmp(hash, pInfo[playerid][pPass]))
                {
                    INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
                    SetPlayerScore(playerid, pInfo[playerid][pScore]);
                    GivePlayerMoney(playerid, pInfo[playerid][pMoney]);
                    pInfo[playerid][pLog] = 1;
                    if(pInfo[playerid][pWarns] >= MAX_WARNS)
                    {
                        new string[100];
                        format(string, sizeof(string), "[SERVER KICK]You have exceeded the warn limit. The maximum warn limit is %d", MAX_WARNS);
                        SCM(playerid, COLOR_RED, string);
                        Kick(playerid);
                    }
                }
                else
                {
                    if(RepeatedAttempts[playerid] >= 3)
                    {
                        Kick(playerid);
                        return 1;
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{98FB98}Log in your account", "This account is already regsitered in our database. Please enter your password to login and load your stats.\nPlease enter the correct password. Repeated attempts will get you kicked.", "Login", "Kick");
                        RepeatedAttempts[playerid]++;
                    }
                }
            }
        }
    }
Y el public que carga las cuentas:

pawn Код:
public loadaccount_user(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][pPass],129);
    INI_Int("AdminLevel",pInfo[playerid][pAdmin]);
    INI_Int("Money",pInfo[playerid][pMoney]);
    INI_Int("Score",pInfo[playerid][pScore]);
    INI_Int("Muted", pInfo[playerid][pMute]);
    INI_Int("Frozen", pInfo[playerid][pFrozen]);
    INI_Int("Warnings", pInfo[playerid][pWarns]);
    INI_Int("Duty", pInfo[playerid][pDuty]);
    INI_Int("NoPM", pInfo[playerid][pNoPM]);
    INI_Int("Kills", pInfo[playerid][pKills]);
    INI_Int("Deaths", pInfo[playerid][pDeaths]);
    INI_Int("VIP", pInfo[playerid][pVIP]);
    INI_Int("ToggleShop", ToggleShop[playerid]);
    return 1;
}
Lo mбs raro de todo es que cuando testeaba en el localhost todo funcionaba perfectamente, йsto sуlo estб ocurriendo desde que hosteй el servidor.



Saludos.
Reply
#2

Simple y Fбcil las variables de PlayerInfo no las estas seteando a 0 en OnPlayerConnect

Ejemplo:

pawn Код:
PlayerInfo[ playerid ] [ pAdmin ] = 0;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)