Whirlpool Problem Loading Password
#1

below are my dialog on register and login but my problem is that register password donot meet login password.
it shows i have enter a wrong password

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch( dialogid )
	{
	    case DIALOG_REGISTER:
	    {
	        switch( response )
	        {
	            case 0: Kick( playerid );
	            case 1:
	            {
	                if( strlen( inputtext ) < 4 || strlen( inputtext ) > 16 ) return Register, SendClientMessage( playerid, COLOR_GREEN, "Invalid amount of characters");
	                new
						INI:pFile = INI_Open(pPath(playerid)),
	                	pBuffer[129],
						RegisterString[128];
	                WP_Hash(pBuffer, sizeof(pBuffer), inputtext);
					INI_SetTag			(pFile, 					"data");
					INI_WriteBool		(pFile, "Logged", 			true);
					INI_WriteBool		(pFile, "Banned", 			false);
					INI_WriteString		(pFile, "Password", 		pBuffer);
					INI_WriteInt     	(pFile, "Admin_level", 		0);
					INI_WriteInt     	(pFile, "Vip_level",  		0);
					INI_WriteInt     	(pFile, "Money",       		STARTMONEY);
					INI_WriteInt     	(pFile, "Score",       		0);
					INI_WriteInt     	(pFile, "Wanted_level", 	0);
					INI_Close(pFile);
					format( RegisterString, sizeof RegisterString, "Thank you for registering %s! Your password is: %s", GetName(playerid), inputtext );
					SendClientMessage( playerid, COLOR_BLUE, RegisterString );
					GivePlayerMoney( playerid, STARTMONEY );
					INI_ParseFile(pPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
	            }
	        }
	        return 1;
	    }
	    case DIALOG_LOGIN:
		{
		    switch( response )
		    {
	  			case 0: Kick( playerid );
	            case 1:
	            {
	                new
	                    pBuffer[129],
						LoginMessage[128];
	                WP_Hash(pBuffer, sizeof(pBuffer), inputtext);
					if( !strcmp( PlayerInfo[playerid][pPassword], pBuffer, false ) )
					{
					    SetPlayerWantedLevel( playerid, PlayerInfo[playerid][pWanted] );
						SetPlayerScore( playerid, PlayerInfo[playerid][pScore] );
						GivePlayerMoney( playerid, PlayerInfo[playerid][pMoney] );
						format( LoginMessage, sizeof LoginMessage, "Welcome back %s. | Admin level: %i | Vip level: %i |", GetName(playerid), PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVip] );
						SendClientMessage( playerid, COLOR_BLUE, LoginMessage );
						return 0;
					}
					else
					{
					    pWarning[playerid]++;
					    switch( pWarning[playerid] )
					    {
					        case 1: SendClientMessage( playerid, COLOR_RED, "Wrong password, please try again. | Warnings: 1/3 |" ), Login;
					        case 2: SendClientMessage( playerid, COLOR_RED, "Wrong password, please try again. | Warnings: 2/3 |" ), Login;
					        case 3: SendClientMessage( playerid, COLOR_RED, "Wrong password, please try again. | Warnings: 3/3 |" ), Login;
					        case 4: SendClientMessage( playerid, COLOR_RED, "Wrong password, therefor you got kicked from the server"), Kick( playerid );
					    }
					    return 0;
					}
	            }
            }
            return 1;
		}
	}
	return 0;
}
here is on register output file
Код:
[data]
Logged = false
Banned = false
Password = FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB
Admin_level = 0
Vip_level = 0
Money = 50000
Score = 0
Wanted_level = 0
PROBLEM SOLVED BY UPDATING YSI PACKAGE THX TO *****
Reply
#2

sorry i tpyed wrong :P eh topic updated

use this:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch( dialogid )
	{
	    case DIALOG_REGISTER:
	    {
	        switch( response )
	        {
	            case 0: Kick( playerid );
	            case 1:
	            {
	                if( strlen( inputtext ) < 4 || strlen( inputtext ) > 16 ) return Register, SendClientMessage( playerid, COLOR_GREEN, "Invalid amount of characters");
	                new
						INI:pFile = INI_Open(pPath(playerid)),
	                	pBuffer[129],
						RegisterString[128];
	                WP_Hash(pBuffer, sizeof(pBuffer), inputtext);
					INI_SetTag			(pFile, 					"data");
					INI_WriteBool		(pFile, "Logged", 			true);
					INI_WriteBool		(pFile, "Banned", 			false);
					INI_WriteString		(pFile, "Password", 		pBuffer);
					INI_WriteInt     	(pFile, "Admin_level", 		0);
					INI_WriteInt     	(pFile, "Vip_level",  		0);
					INI_WriteInt     	(pFile, "Money",       		STARTMONEY);
					INI_WriteInt     	(pFile, "Score",       		0);
					INI_WriteInt     	(pFile, "Wanted_level", 	0);
					INI_Close(pFile);
					format( RegisterString, sizeof RegisterString, "Thank you for registering %s! Your password is: %s", GetName(playerid), inputtext );
					SendClientMessage( playerid, COLOR_BLUE, RegisterString );
					GivePlayerMoney( playerid, STARTMONEY );
					INI_ParseFile(pPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
	            }
	        }
	        return 1;
	    }
	    case DIALOG_LOGIN:
		{
		    switch( response )
		    {
	  			case 0: Kick( playerid );
	            case 1:
	            {
	                new
	                    pBuffer[129],
						LoginMessage[128];
	                WP_Hash(pBuffer, sizeof(pBuffer), inputtext);
					if( !strcmp( INI_Int(pFile,"Password"), pBuffer, true ) )
					{
					    SetPlayerWantedLevel( playerid, PlayerInfo[playerid][pWanted] );
						SetPlayerScore( playerid, PlayerInfo[playerid][pScore] );
						GivePlayerMoney( playerid, PlayerInfo[playerid][pMoney] );
						format( LoginMessage, sizeof LoginMessage, "Welcome back %s. | Admin level: %i | Vip level: %i |", GetName(playerid), PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVip] );
						SendClientMessage( playerid, COLOR_BLUE, LoginMessage );
						return 0;
					}
					else
					{
					    pWarning[playerid]++;
					    switch( pWarning[playerid] )
					    {
					        case 1: SendClientMessage( playerid, COLOR_RED, "Wrong password, please try again. | Warnings: 1/3 |" ), Login;
					        case 2: SendClientMessage( playerid, COLOR_RED, "Wrong password, please try again. | Warnings: 2/3 |" ), Login;
					        case 3: SendClientMessage( playerid, COLOR_RED, "Wrong password, please try again. | Warnings: 3/3 |" ), Login;
					        case 4: SendClientMessage( playerid, COLOR_RED, "Wrong password, therefor you got kicked from the server"), Kick( playerid );
					    }
					    return 0;
					}
	            }
            }
            return 1;
		}
	}
	return 0;
}
Reply
#3

that doesnt work

EDIT: even it cause compiler to crash
Reply
#4

Код:
ON REGISTER:
[15:35:39] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2

ON LOGIN TRY1:
[15:36:18] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
ON LOGIN TRY2:
[15:36:45] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
ON LOGIN TRY3:
[15:36:54] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
ON LOGIN TRY4:
[15:36:56] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
AFTER KICK....
EDIT: ALSO REMOVED P FROM EVERY VARIABLE
Reply
#5

ON REGISTER HASHED PASSWORD
Код:
ON REGISTER:
[15:35:39] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
ON LOGIN HASHED PASSWORD
Код:
ON LOGIN TRY1:
[15:36:18] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
ON LOGIN TRY2:
[15:36:45] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
ON LOGIN TRY3:
[15:36:54] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
ON LOGIN TRY4:
[15:36:56] FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB2
AFTER KICK....
BUT IN THE FILE IT IS MISSING LAST CHARACTER
Код:
FD9D94340DBD72C11B37EBB0D2A19B4D05E00FD78E4E2CE8923B9EA3A54E900DF181CFB112A8A73228D1F3551680E2AD9701A4FCFB248FA7FA77B95180628BB
TEST PASSWORD IS: 123456
should i need to update yini ??
to fix that problem
Reply
#6

thx ****** its now working i fully updated my ysi package
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)