dialog login Help
#1

hey when i enter and uncorrect password he continue to game i want him if uncorrect password the dialog come again and if you set it 3 times you Auto kick Pls help me.

this code of case 125 that is Login dialog.

Код:
		case 125:
		{
		   if(!response)
		   {
                Kick(playerid);
           }
		   if (udb_Exists(PlayerName2(playerid))) {
              if (udb_CheckLogin(PlayerName2(playerid),inputtext))
	          {
		       new file[256], tmp3[100], string[128];
	   	       format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
   		       GetPlayerIp(playerid,tmp3,100);
	   	       dini_Set(file,"ip",tmp3);
		       LoginPlayer(playerid);
		       PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		       if(PlayerInfo[playerid][Level] > 0) {
			       format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
			       new text[128];
		       format(text, sizeof(text), "Promoted! Rank %s.", GetRankName(playerid));
	         	SendClientMessage(playerid, COLOR_WHITE, text);
			       return SendClientMessage(playerid,green,string);
       	       } else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
	       }
	       else {
		       PlayerInfo[playerid][FailLogin]++;
		       printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid),inputtext, PlayerInfo[playerid][FailLogin] );
		       if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
		       {
			       new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)", PlayerName2(playerid) );
			       SendClientMessageToAll(red, string);
			       print(string);
			       Kick(playerid);
		           }
		      }
		}
		new string[200];
	    format(string, sizeof(string),""cwhite"Welcome "cred"%s "cwhite"you are already registered\nKindly enter password to login to your account\n"cred"Incorrect password!", PlayerName2(playerid));
		ShowPlayerDialog(playerid, 125, DIALOG_STYLE_INPUT, "Login",string,"Login","Kick");
	}
Reply
#2

that is because u did not compare the password entered with the saved password to fail the login
Reply
#3

you can do like this to compare password

new tmp[MAX_STRING]; tmp = dini_Get(file, "hashPW");
if(udb_hash(params) != strval(tmp))
{ //msg or code you want//};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)