Auto Login Problems
#1

I have recent added Auto Login to my server. The dialog shows but i put the right password then it said wrong password and auto login me in.

Код:
case LoginDialog:
        {
            if(!response) Kick(playerid);

            new hashpass[129], query[100], playername[MAX_PLAYER_NAME], string[80];
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerIp(playerid, IP[playerid], 16);
            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            if (!strcmp(IP[playerid], string, true))
            {
                 mysql_format(Database, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", ReturnName(playerid));
	             mysql_tquery(Database, query, "OnAccountLoad", "i", playerid);
            }
            else
            if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
            {
                mysql_format(Database, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", playername);
                mysql_tquery(Database, query, "OnAccountLoad", "i", playerid);
            }
            ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_PASSWORD, "Trucking: {FFFF00}Login", "Welcome Back Trucking Veteran, Please login to continue:", "Login", "Leave");
            SendClientMessage(playerid, COLOUR_RED, "Wrong Password");
        }
Reply
#2

If you enter the correct password you need to skip this lines from execute:

pawn Код:
ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_PASSWORD, "Trucking: {FFFF00}Login", "Welcome Back Trucking Veteran, Please login to continue:", "Login", "Leave");
            SendClientMessage(playerid, COLOUR_RED, "Wrong Password");
Something like this:

pawn Код:
case LoginDialog:
        {
            if(!response) Kick(playerid);

            new hashpass[129], query[100], playername[MAX_PLAYER_NAME], string[80];
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerIp(playerid, IP[playerid], 16);
            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            if (!strcmp(IP[playerid], string, true))
            {
                 mysql_format(Database, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", ReturnName(playerid));
             mysql_tquery(Database, query, "OnAccountLoad", "i", playerid);
                 return 1;
            }
            else
            if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
            {
                mysql_format(Database, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", playername);
                mysql_tquery(Database, query, "OnAccountLoad", "i", playerid);
                return 1;
            }
            ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_PASSWORD, "Trucking: {FFFF00}Login", "Welcome Back Trucking Veteran, Please login to continue:", "Login", "Leave");
            SendClientMessage(playerid, COLOUR_RED, "Wrong Password");
        }
Reply
#3

It don't auto login.
Reply
#4

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Код:
new hashpass[129], query[100], playername[MAX_PLAYER_NAME], string[80];
GetPlayerIp(playerid, IP[playerid], 16);
if (!strcmp(IP[playerid], string, true))
This makes no sense. You are comparing IP to an empty string and strcmp returns false.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)