SA-MP Forums Archive
Auto Login Problems - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Auto Login Problems (/showthread.php?tid=656270)



Auto Login Problems - DerickClark - 11.07.2018

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");
        }



Re: Auto Login Problems - diego200052 - 11.07.2018

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");
        }



Re: Auto Login Problems - DerickClark - 11.07.2018

It don't auto login.


Re: Auto Login Problems - Calisthenics - 11.07.2018

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.