I'v Fucked Somthing(Register/Login) REP+
#1

Ok, so basically IDK what I did wrong.. Heres my login/register, the thing is, they can register the first time, but after they disconnect and everything, they try to relog and there password is diffrent, and there pass gets set to 0..

pawn Код:
//OnDialogResponse

    if(dialogid == DIALOG_REGISTER)
    {
        if (!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""EMBED_WHITE"Registering...",""EMBED_RED"You have entered an invalid password.\n"EMBED_WHITE"Type your password below to register a new account.","Register","Quit");
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"data");
            INI_WriteInt(File,"Password",udb_hash(inputtext));
            INI_WriteInt(File,"Money",0);
            INI_WriteInt(File,"Admin",0);
            INI_WriteInt(File,"Kills",0);
            INI_WriteInt(File,"Deaths",0);
            INI_WriteInt(File,"Score",0);
            INI_WriteInt(File,"VIP",0);
            INI_WriteInt(File,"Wanted",0);
            INI_WriteInt(File,"Job",0);
            INI_WriteInt(File,"CarX",0);
            INI_WriteInt(File,"CarY",0);
            INI_WriteInt(File,"CarZ",0);
            INI_WriteInt(File,"CarA",0);
            INI_Close(File);
        }
    }
//OnPlayerDisconnect
        new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Password",PlayerInfo[playerid][Password]);
    INI_WriteInt(File,"Cash",PlayerInfo[playerid][Money]);
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][Admin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
    INI_WriteInt(File,"VIP",PlayerInfo[playerid][VIP]);
    INI_WriteInt(File,"Vehicle",PlayerInfo[playerid][Vehicle]);
    INI_WriteInt(File,"Wanted",PlayerInfo[playerid][Wanted]);
    INI_WriteInt(File,"Job",PlayerInfo[playerid][Job]);
    INI_WriteFloat(File,"CarX",PlayerInfo[playerid][CarX]);
    INI_WriteFloat(File,"CarY",PlayerInfo[playerid][CarY]);
    INI_WriteFloat(File,"CarZ",PlayerInfo[playerid][CarZ]);
    INI_WriteFloat(File,"CarA",PlayerInfo[playerid][CarA]);
    INI_Close(File);
//Userpath stock
    stock UserPath(playerid)
    {
         new string[128],playername[MAX_PLAYER_NAME];
         GetPlayerName(playerid,playername,sizeof(playername));
         format(string,sizeof(string),PATH,playername);
         return string;
    }
//LoadUser Data
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][Password]);
    INI_Int("Cash",PlayerInfo[playerid][Money]);
    INI_Int("Admin",PlayerInfo[playerid][Admin]);
    INI_Int("Kills",PlayerInfo[playerid][Kills]);
    INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
    INI_Int("Score",PlayerInfo[playerid][Score]);
    INI_Int("VIP",PlayerInfo[playerid][VIP]);
    INI_Int("Vehicle",PlayerInfo[playerid][Vehicle]);
    INI_Int("Wanted",PlayerInfo[playerid][Wanted]);
    INI_Int("Job",PlayerInfo[playerid][Job]);
    INI_Float("CarX",PlayerInfo[playerid][CarX]);
    INI_Float("CarY",PlayerInfo[playerid][CarY]);
    INI_Float("CarZ",PlayerInfo[playerid][CarZ]);
    INI_Float("CarA",PlayerInfo[playerid][CarA]);
    return 1;
}
Well, thers all I can think of, if anything else is needed posted then tell me, IDK what the issue is.. I registered my account fine the first time I created the system (using a tutorial) so my stats and everything save, just not others?
Reply
#2

Delete this line under OnPlayerDisconnect(playerid);
pawn Код:
INI_WriteInt(File,"Password",PlayerInfo[playerid][Password]); // Delete this line under OnPlayerDisconnect
Reply
#3

Thxx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)