Saving system malfunction
#1

So, I've recently discovered this bug while I'm bored, I entered my server with the wrong tag, and I was now prompted to type what is my password(the wrong tag account was registered). Instead of typing my password on the dialog, I tried to type /q and pressed OK. And you know what happens. It suddenly continued me to the Announcements screen.

I've tried my friend's account with the lol password and it worked. This is my code:
pawn Code:
//OnDialogResponse
   switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Making your account ..",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"PlayerData");
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                INI_WriteString(File, "Password", HashPass);
                INI_WriteInt(File,"Cash",10000);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Headshots",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Resistance_Squad",0);
                INI_WriteInt(File,"Country_Rebels",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"Reputation",0);
                INI_Close(File);
            }
        }
        case DIALOG_LOGIN:
        {
            if (!response) return Kick (playerid);
            if( response )
            {
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0)
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                    SetTimerEx("autosave", 10000, false, "i", playerid);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Announcements",""COL_VIOLET"5/7/2014 | 5:21 pm(GMT+4:00):\n"COL_WHITE"Project FRIENDS is initiated! The main course for Project FRIENDS is to increase the playerbase!\nMore info at pvt.boards.net!","OK","");
                    exception[playerid] = 1;
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login at [PVT] Police vs Terrorists",""COL_RED"You have entered an "COL_RED"incorrect"COL_WHITE" password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 0;
}
pawn Code:
//OPC(OnPlayerConnect)
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login at [PVT] Police vs Terrorists",""COL_WHITE"Your name is "COL_GREEN"registered"COL_WHITE" in our databases!\nType your password below to login on your existing account.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Register at [PVT] Police vs Terrorists",""COL_WHITE"Your name is "COL_RED"not registered"COL_WHITE" in our databases!\nType your password below to register a new account.","Register","Quit");
    }
    return 1;
}
pawn Code:
//Enums and shit
#define PATH "/Players/%s.ini"
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pHeadshots,
    pScore,
    pVIP,
    pBankmoney,
    pClass,
    pTarget,
    pFaction1,
    pFaction2,
    pDuty,
    pRep
}

new PlayerInfo[MAX_PLAYERS][pInfo];
new PlayerKills[MAX_PLAYERS];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Headshots",PlayerInfo[playerid][pHeadshots]);
    INI_Int("Bank",PlayerInfo[playerid][pBankmoney]);
    INI_Int("Resistance_Squad",PlayerInfo[playerid][pFaction1]);
    INI_Int("Country_Rebels",PlayerInfo[playerid][pFaction2]);
    INI_Int("VIP",PlayerInfo[playerid][pVIP]);
    INI_Int("Reputation",PlayerInfo[playerid][pRep]);
    return 1;
}

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

native WP_Hash(buffer[], len, const str[]);
You should now what is my OPD(OnPlayerDisconnect) scripts already.

EDIT: Please! I can't let my players abuse on each other!
Reply


Messages In This Thread
Saving system malfunction, please help! - by TheSimpleGuy - 19.05.2014, 11:11
Re: Saving system malfunction - by Threshold - 19.05.2014, 14:04

Forum Jump:


Users browsing this thread: 1 Guest(s)