#1

PHP код:
case DIALOG_LOGIN:
        {
            if(!
response) Kick(playerid);
            
SetPVarInt(playerid, "salahlogin", (GetPVarInt(playerid, "LogginAttempts") +1));//the code
            
if (!(MIN_PASSWORD_LENGTH <= strlen(inputtext) <= MAX_PASSWORD_LENGTH))
            {
                    if (
GetPVarInt(playerid, "salahlogin") == MAX_LOGGIN_ATTEMPTS) return Kick(playerid);//the
                    
new string[144];//the code
                    
format(string, sizeof(string), "ERROR: Invalid password length, must be (correct length: %d/%d)", MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH);//the code
                    
SendClientMessage(playerid, 0xDC143CFF, string);//the code
                    
format(string, sizeof(string), "{FFFFFF}Enter your password then hit \"Submit\"\n\n \
                                                    Error: Insert your correct password{DC143C}(attempts: %d/%d)"
, GetPVarInt(playerid, "salahlogin"), MAX_LOGGIN_ATTEMPTS);//the code
            
}
            new 
hash[64];
            
SHA256_PassHash(inputtext, "", hash, 64);
            if(!
strcmp(hash, UserInfo[playerid][p_password]))
            {
                
//Load player data
                
new handle = SL::Open(SL::READ, "players", "p_idac", UserInfo[playerid][p_id]);
                
SL::ReadInt(handle, "score", UserInfo[playerid][p_score]);
                
SL::ReadFloat(handle, "p_posxeon", UserInfo[playerid][p_posx]);
                
SL::ReadFloat(handle, "p_posyoung", UserInfo[playerid][p_posy]);
                
SL::ReadFloat(handle, "p_poszebra", UserInfo[playerid][p_posz]);
                
SL::Close(handle);
                
SetPlayerScore(playerid, UserInfo[playerid][p_score]);
                
UserInfo[playerid][p_loggedin] = 1;
                
SendClientMessage(playerid, -1, "Successfully logged in!");
            }
            else
            {
                
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{0080FF}Login", "Please input your password below to log in.", "Login", "Exit");
            } 
my max attempts login not work.
Reply
#2

SetPVarInt(playerid, "salahlogin", (GetPVarInt(playerid, "salahlogin") +1));

The name "LogginAttempts" is nowhere used.
Reply
#3

Same not working
Reply
#4

Anyone
Reply
#5

Give this a try

PHP код:
case DIALOG_LOGIN: 
        { 
            if(!
response) Kick(playerid); 
            
SetPVarInt(playerid, "salahlogin", (GetPVarInt(playerid, "salahlogin") +1));//the code 
            
if (GetPVarInt(playerid, "salahlogin") == MAX_LOGGIN_ATTEMPTS) return Kick(playerid);//the 
            
if (!(MIN_PASSWORD_LENGTH <= strlen(inputtext) <= MAX_PASSWORD_LENGTH)) 
            { 
                    new 
string[144];//the code 
                    
format(string, sizeof(string), "ERROR: Invalid password length, must be (correct length: %d/%d)", MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH);//the code 
                    
SendClientMessage(playerid, 0xDC143CFF, string);//the code 
                    
format(string, sizeof(string), "{FFFFFF}Enter your password then hit \"Submit\"\n\n \ 
                                                    Error: Insert your correct password{DC143C}(attempts: %d/%d)"
, GetPVarInt(playerid, "salahlogin"), MAX_LOGGIN_ATTEMPTS);//the code 
            
} 
            new 
hash[64]; 
            
SHA256_PassHash(inputtext, "", hash, 64); 
            if(!
strcmp(hash, UserInfo[playerid][p_password])) 
            { 
                
//Load player data 
                
new handle = SL::Open(SL::READ, "players", "p_idac", UserInfo[playerid][p_id]); 
                
SL::ReadInt(handle, "score", UserInfo[playerid][p_score]); 
                
SL::ReadFloat(handle, "p_posxeon", UserInfo[playerid][p_posx]); 
                
SL::ReadFloat(handle, "p_posyoung", UserInfo[playerid][p_posy]); 
                
SL::ReadFloat(handle, "p_poszebra", UserInfo[playerid][p_posz]); 
                
SL::Close(handle); 
                
SetPlayerScore(playerid, UserInfo[playerid][p_score]); 
                
UserInfo[playerid][p_loggedin] = 1; 
                
SendClientMessage(playerid, -1, "Successfully logged in!"); 
            } 
            else 
            { 
                
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{0080FF}Login", "Please input your password below to log in.", "Login", "Exit"); 
            } 
Reply


Forum Jump:


Users browsing this thread: