Account password not working
#1

I can register ok & run about but when i login again my pass dont work. everything compiles fine no errors, there users directory is there user files get created. just the passwords dont seem to be readable after hashing


Код:
//-----[ENUMS]-----
enum PlayerInfo
{
    Pass[129],
    Adminlevel,
    VIPlevel,
    Money,
    Scores,
    Kills,
    Deaths,
	Warnings,
}
new pInfo[MAX_PLAYERS][PlayerInfo];
Код:
public OnPlayerConnect(playerid)
{
	new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
{
        INI_ParseFile(Path(playerid),"loadaccount_Data", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,dlogin, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login",""COL_WHITE"This account is {00FF22}already registered.\n{FFFFFF}Please login by entering your password in below","Login","Quit");
    }
    else
    {
		ShowPlayerDialog(playerid,dregister, DIALOG_STYLE_PASSWORD,""COL_RED"Register",""COL_WHITE"This account is{F81414} not yet registered \n{FFFFFF}Please create an account by typing your desired password below","Register","Quit");
        return 1;
    }
	return 1;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(JailTimer[playerid]);
	QuestionAsked[playerid] = false;
	format(Question[playerid], 256, " ");

    if(fexist(Path(playerid)))
    {
        new INI:file = INI_Open(Path(playerid));
        INI_SetTag(file,"Data");
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
		INI_WriteInt(file,"Warnings",pInfo[playerid][Warnings]);

        INI_Close(file);
        return 1;
    }
    return 1;
}
Код:
public loadaccount_Data(playerid, name[], value[])

{
    INI_String("Password", pInfo[playerid][Pass],129);
    INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
    INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
    INI_Int("Money",pInfo[playerid][Money]);
    INI_Int("Scores",pInfo[playerid][Scores]);
    INI_Int("Kills",pInfo[playerid][Kills]);
    INI_Int("Deaths",pInfo[playerid][Deaths]);
    INI_Int("Warnings",pInfo[playerid][Warnings]);
    return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == dregister)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 1;
            }

            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Data");
            INI_WriteString(file,"Password",hashpass);
            INI_WriteInt(file,"AdminLevel",0);
            INI_WriteInt(file,"VIPLevel",0);
            INI_WriteInt(file,"Money",0);
            INI_WriteInt(file,"Scores",0);
            INI_WriteInt(file,"Kills",0);
            INI_WriteInt(file,"Deaths",0);
            INI_WriteInt(file,"Warnings",0);
            INI_Close(file);
            SendClientMessage(playerid, GREEN ,"You successfuly created an account!");

            new
				str[ 128 ];

			format(str, sizeof(str), "[NEW ACCOUNT] Player %s has registered a new account!", GetName(playerid));
			SendClientMessageToAll(GREEN, str);
            return 1;
        }
    }
    if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!strcmp(hashpass,pInfo[playerid][Pass]))
            {
                INI_ParseFile(Path(playerid),"loadaccount_Data",.bExtra = true, .extra = playerid);
                SetPlayerScore(playerid,pInfo[playerid][Scores]);
                GivePlayerMoney(playerid,pInfo[playerid][Money]);
				SendClientMessage(playerid, GREEN,"You have successfully logged in");
				new str[ 128 ], name[ MAX_PLAYER_NAME ]; GetPlayerName( playerid, name, MAX_PLAYER_NAME );
				if ( pInfo[ playerid ][ Adminlevel ] > 0 )
				{
					format( str, sizeof ( str ), "Administrator %s has logged in!", name );
					SendClientMessageToAll( 0xFF9500FF, str);
				}
            }
            else
            {
                ShowPlayerDialog(playerid,dlogin, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login",""COL_RED"You have entered an{F81414} incorrect password.\n"COL_WHITE"Please try again","Login","Quit");
                return 1;
            }
        }
    }
	return 1;
}
Reply
#2

Replace:
pawn Код:
INI_ParseFile(Path(playerid),"loadaccount_Data", .bExtra = true, .extra = playerid);
with
pawn Код:
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
And to check if the hashed password is extracted correctly add this:
pawn Код:
public loadaccount_Data(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][Pass],129);
    INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
    INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
    INI_Int("Money",pInfo[playerid][Money]);
    INI_Int("Scores",pInfo[playerid][Scores]);
    INI_Int("Kills",pInfo[playerid][Kills]);
    INI_Int("Deaths",pInfo[playerid][Deaths]);
    INI_Int("Warnings",pInfo[playerid][Warnings]);
    new str[256];
    format(str,256,"Your password is: %s",PlayerInfo[playerid][pPass]);
    SCM(playerid,0xFFFFFFFF,str);
    return 1;
}
Reply
#3

C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(297) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(297) : warning 215: expression has no effect
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(297) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(297) : error 029: invalid expression, assumed zero
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(297) : fatal error 107: too many error messages on one line
Reply
#4

pawn Код:
new str[256];
    format(str,256,"Your password is: %s",pInfo[playerid][pPass]);
    SCM(playerid,0xFFFFFFFF,str);
Reply
#5

C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(297) : error 017: undefined symbol "pPass"
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(29 : error 017: undefined symbol "SCM"
Reply
#6

pawn Код:
new str[256];
    format(str,256,"Your password is: %s",pInfo[playerid][Pass]);
    SendClientMessage(playerid,0xFFFFFFFF,str);
Sorry I'm used with my gm.
Reply
#7

Aly do you have skype? or something that you could help fix this?
Reply
#8

still not working
Reply
#9

Yeah, but I'm not sure if i can give it here.
Reply
#10

add it then edit the post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)