Dialog Problem
#1

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_REGISTER:
        {
            if(!
response)
            {
                 
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You must register to play at "NAME"","Close","");
                
Kick(playerid);
            }
            if(
response)
            {
                new 
str[256],IP[16],hashpass[129];
                
GetPlayerIp(playeridIPsizeof(IP));
                if(!
strlen(inputtext))
                {
                    
format(str,sizeof(str),""chat"Welcome %s to "NAME"",PlayerName(playerid));
                    
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD,str,""chat" Welcome to "NAME" you'll be forced to register please click register!","Register","Quit");
                }
                
WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
                
new INI:File INI_Open(UserPath(playerid));
                
/*new INI:File = INI_Open(UserPath(playerid));
                WP_Hash(buf, sizeof(buf), inputtext);*/
                
INI_SetTag(File,"data");
                
//INI_WriteString(File, "pPassword", buf);
                
INI_WriteString(File,"Password",inputtext);
                
INI_WriteInt(File,"pXP",0);
                
INI_WriteInt(File,"pKills",0);
                
INI_WriteInt(File,"pDeaths",0);
                
INI_WriteInt(File,"pRank",0);
                
INI_WriteInt(File,"pEvac",0);
                
INI_WriteInt(File,"pAdminLevel",0);
                
INI_WriteInt(File,"pAdminDuty",0);
                
INI_WriteInt(File,"pVipLevel",0);
                
INI_WriteInt(File,"pHour",0);
                
INI_WriteInt(File,"pMin",0);
                
INI_WriteInt(File,"pSec",0);
                
INI_WriteInt(File,"pMapsPlayed",0);
                
INI_WriteInt(File,"pCoins",0);
                
INI_WriteString(File,"pIP",IP);
                
INI_WriteInt(File,"pBanned",0);
                
INI_WriteInt(File,"gLeader",0);
                
INI_WriteInt(File,"gMember",0);
                
INI_Close(File);
                
                 
TextDrawHideForPlayer(playeridlogin0);
                
TextDrawHideForPlayer(playeridlogin1);
                
TextDrawHideForPlayer(playeridlogin2);
                
TextDrawHideForPlayer(playeridlogin3);
                
playedtimer[playerid] = SetTimerEx("TimeOnServer"10001"i"playerid);
                
pInfo[playerid][pLogged] = 1;
            }
        }
        case 
DIALOG_LOGIN:
        {
              if(!
response)
            {
                 
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_MSGBOX,"Kicked",""chat" You must login to play at "NAME"","Close","");
                
Kick(playerid);
            }
            if(
response)
            {
                new 
hashpass[129];
                
WP_Hash(hashpass,sizeof(hashpass),inputtext);
                if(!
strcmp(inputtext,pInfo[playerid][pPassword]))
                {
                    
//INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                    
INI_ParseFile(UserPath(playerid), "LoadUser_data",.bExtra true, .extra playerid);
                    
pInfo[playerid][pLogged] = 1;
                    
playedtimer[playerid] = SetTimerEx("TimeOnServer"10001"i"playerid);
                    
SendClientMessage(playerid,-1,""chat""COL_LGREEN" Logged in!");
                    
printf("%s",pInfo[playerid][pPassword]);
                    
TextDrawHideForPlayer(playeridlogin0);
                    
TextDrawHideForPlayer(playeridlogin1);
                    
TextDrawHideForPlayer(playeridlogin2);
                    
TextDrawHideForPlayer(playeridlogin3);
                }
                else
                {
                    new 
string[256];
                    
format(string,sizeof(string),""chat" Welcome back %s",PlayerName(playerid));
                    
ShowPlayerDialog(playeridDIALOG_LOGIN,DIALOG_STYLE_PASSWORD,string,""chat" Our system have detected your username registered please login","Login","Quit");
                }
                return 
1;
            }
        } 
Idk what is the problem here but, dont have errors .
when i login when is correct and incorrect password he logged in
help mee please how to fix this.
Reply
#2

strcmp will return 0 when the strings are the same, but also when one of the strings is empty. Have you checked if the password is saved in the ini file? Is the ini file created in the first place?
Reply
#3

I dont understand nothing Please give mee code.
Reply
#4

I can't give you any code. I asked you, if the password string is saved in the ini file. If you don't understand English, ask in the language section for your language. If that language section does not exist, try translating my text with a translation program or let someone translate it who knows both languages.
Reply
#5

Look see this model similar record, try to correct your
Reply
#6

You're saving inputtext in DIALOG_REGISTER, not the hashed password.
Reply
#7

Heah i want to save the inputtext and in dialog login i want the inputtext
Reply
#8

Bump. AnyOne?
Reply
#9

Bump PLEASEEEEE
Reply
#10

For everyone's sake, follow the damn rules...
Don't bump before 24 hours.

You're hashing in DIALOG_LOGIN, but you're not hashing DIALOG_REGISTER.

It's better if you hash them. I wouldn't join your server if you can know my password.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)