password invalid
#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

Try this tut.Its working fine https://sampforum.blast.hk/showthread.php?tid=442588
Reply
#3

Giroud Thank for that but i really dont wont to change scripts if i dont have to
Reply
#4

try this
pawn Код:
public OnPlayerConnect(playerid)
{
        new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .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;
}
Reply
#5

C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(185) : warning 217: loose indentation
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(194) : warning 217: loose indentation
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Copy of Titanium Roleplay with login\gamemodes\titanium.pwn(196) : warning 217: loose indentation
Reply
#6

pawn Код:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .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;
}
Reply
#7

still nothing Ice
Reply
#8

check this
http://pastebin.com/0egAGFWr

i hope this will help you
Reply
#9

pawn Код:
loadaccount_%s
change to
pawn Код:
loadaccount_data
Reply
#10

That is my Gm lol i posted it so ppl can have a look at the code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)