Password problem
#1

Well, i don't know why when i type my/everyone password wrong, next time , even if i write it correctly the server still kicks me for wrong password.

PHP код:
    if(dialogid == 15500//Dialog login
    
{
        if(!
response)
        {
            
Kick(playerid);
        }
        if(
response)
        {
            if(
Wrongpass[playerid] >= 1)
            {
                  
GetPlayerNameplayeridNamsizeof Nam );
                
formatmystringsizeof mystring"Admin-Log: %s has been kicked for wrong password."Nam);
                
SendAdminMessageCOLOR_WHITEmystring);
                
SendClientMessage(playeridCOLOR_RED"You have been kicked for wrong password.");
                   
Kick(playerid);
            }
            
ShowPlayerDialog(playerid15500+1DIALOG_STYLE_MSGBOX"{FFFFFF}Rules!""{00FFFF}Server rules!\n\n{FFFFFF}- Do not deathmatch unless an admin has started a DM event or anything similar to that.\n{FFFFFF}- Don't spam/flood the server chat.\n- Don't insult people.\n{FFFFFF}- Don't go around and annoy people that is drifting. (eg ramming)\n\n{00FFFF}By clicking the Ok button you will agree with those terms.","Ok","");
            new 
query[200], pnamez[24], escapepass[100];
            
GetPlayerName(playeridpnamez24);
            
mysql_real_escape_string(inputtextescapepass);
            
format(querysizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = SHA1('%s')"pnamezescapepass);
            
mysql_query(query);
            
mysql_store_result();
            
            new 
numrows mysql_num_rows();
            if(
numrows == 1MySQL_Login(playerid);
            if(!
numrows)
            {
                  new 
strz[182];
                
GetPlayerName(playerid,pname,sizeof(pname));
                
format(strz,sizeof(strz), "{00FFFF}Account: {FFFFFF}%s\n\n{FF0000}ERROR: {FFFFFF}You have entered an invalid password.\n\n{FFFFFF}Type your password below in order to login.",pname);
                
ShowPlayerDialog(playerid15500DIALOG_STYLE_PASSWORD"{FFFFFF}Login"strz,"Login","Quit");
                
Wrongpass[playerid]++;
                
            }
            
mysql_free_result();
        }
    } 
Reply
#2

what is your password saving, registering and login code
Reply
#3

You really dont need the rest of the code.
Worked good until i added the wrongpass variable.
Reply
#4

ofcourse we do, We need to know if you use a whirlpool or anything like that.


Also, did you place

pawn Код:
Wrongpass[playerid] = 0;
when a player enters the right password?
Reply
#5

I dont use whirlpool.
And yes.
Reply
#6

That's because that if structure will return true if the 'WrongPass' variable is greater than, or equal to 1. Either change that 1 to 2 or change your >= to just >.
Reply
#7

Thanks Vince.
Reply


Forum Jump:


Users browsing this thread: