Another Login Problem!
#1

Hi,

After i fixed my previous problem now i have this! Read carefully, When i have to register my password got saved for sure all fine example (mypassword123), but when i came to login and type example (123) which isn't not my password i got message "The password you entered is incorrect" BUT I am logged in and i can counitnue with gaming I'm really confused right now! All help with be appricated +REP if helped!

Код:
if( response )
	{
		new string1[30], hashpass[129];
  		WP_Hash(hashpass,sizeof(hashpass),inputtext);
	        if(!strcmp(hashpass, PlayerInfo[playerid][PASSWORD], false))
		{
			INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
			GivePlayerMoney(playerid, PlayerInfo[playerid][MONEY]);
			SetPVarInt(playerid, "gLogged", 1);
			SendClientMessage(playerid, -1, "SERVER: You have successfully logged!");
		}
  		else
		{
  		  	if(GetPVarInt(playerid, "FailedLoginAttempt") == 0)
                        {
   				SetPVarInt(playerid, "FailedLoginAttempt", 1);
   				SendClientMessage(playerid, -1, "SERVER: The password you have entered is incorrect (1/3 attempts used).");
			}
			else if(GetPVarInt(playerid, "FailedLoginAttempt") == 1)
			{
   				SetPVarInt(playerid, "FailedLoginAttempt", 2);
   				SendClientMessage(playerid, -1, "SERVER: The password you have entered is incorrect (2/3 attempts used).");
			}
			else if(GetPVarInt(playerid, "FailedLoginAttempt") == 2)
			{
   				SetPVarInt(playerid, "FailedLoginAttempt", 3);
   				SendClientMessage(playerid, -1, "SERVER: The password you have entered is incorrect (3/3 attempts used).");
			}
			else if(GetPVarInt(playerid, "FailedLoginAttempt") == 3)
			{
   				DeletePVar(playerid, "FailedLoginAttempt");
   				SendClientMessage(playerid, -1, "SERVER: You have used up all your login attempts, and hence got kicked.");
			    Kick(playerid);
			}
   			ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", string1, "Login", "Cancel");
   		}

	}
}
}
return 1;
}
Reply
#2

Not sure but this could work:
Код:
if(!strcmp(hashpass, PlayerInfo[playerid][PASSWORD], false))
Remove the !
Reply
#3

Same problem, it's should pass though all failedloginattempt if i type password wrong and kick me at the end! and if i type a correct password it should be ok
Reply
#4

EDITED: NVM its wrong
Reply
#5

When i first time enter wrong password "Server Closed Connection" without any wrong password message
Reply
#6

and i forget to tell at last part using Kick(playerid); will kick him instatly and he wont see that ClientMessage
if you wanted him to see that you have to use timers
like this:
PHP код:
forward KickPlayer(playerid);
if(
GetPVarInt(playerid"FailedLoginAttempt") == 3)
    {
        
DeletePVar(playerid"FailedLoginAttempt");
        
SendClientMessage(playerid, -1"SERVER: You have used up all your login attempts, and hence got kicked.");
        
SetTimerEx("KickPlayer",1000,false,"i",playerid);
    }
    
public 
KickPlayer(playerid)
{
    
Kick(playerid);
    return 
1;

Reply
#7

Thanks for trying to help me out but now! When i type wrong password i got message "The password you have entered is incorrect (1/3 attempts used)" but i am in class selection and i can spawn myself, there is no dialog to return back to login xD
Reply
#8

what are you doing you have to use else if. Your code means, if a variable is 0 increase it by 1, again check is it one and then again increase it then its 2 and so on.

EDIT: Big mistake the return will work.
Reply
#9

I did it like this and it's only show first password is incorrect and there is no dialog return for other and i can spawn myself!

Код:
if(GetPVarInt(playerid, "FailedLoginAttempt") == 0)
    		{
        		SetPVarInt(playerid, "FailedLoginAttempt", 1);
        		SendClientMessage(playerid, -1, "SERVER: The password you have entered is incorrect (1/3 attempts used).");
        		ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", string1, "Login", "Cancel");
     		}
      		else if(GetPVarInt(playerid, "FailedLoginAttempt") == 1)
       		{
            	SetPVarInt(playerid, "FailedLoginAttempt", 2);
              	SendClientMessage(playerid, -1, "SERVER: The password you have entered is incorrect (2/3 attempts used).");
              	ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", string1, "Login", "Cancel");
    		}
     		else if(GetPVarInt(playerid, "FailedLoginAttempt") == 2)
      		{
               	SetPVarInt(playerid, "FailedLoginAttempt", 3);
      			SendClientMessage(playerid, -1, "SERVER: The password you have entered is incorrect (3/3 attempts used).");
       	  		ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", string1, "Login", "Cancel");
       		}
    		else if(GetPVarInt(playerid, "FailedLoginAttempt") == 3)
    		{
        		DeletePVar(playerid, "FailedLoginAttempt");
           		SendClientMessage(playerid, -1, "SERVER: You have used up all your login attempts, and hence got kicked.");
        		Kick(playerid);
		  	}
Reply
#10

im to bussy i cant make you sosry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)