SA-MP Forums Archive
Auto login problem :/ - 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 problem :/ (/showthread.php?tid=293473)



Auto login problem :/ - knackworst - 28.10.2011

Hello, I ran into troubles making an automatically login system... but it doesn't work
pawn Код:
public OnPlayerConnect(playerid)
{
    new tmpIP[16];
    GetPlayerIp(playerid,tmpIP,sizeof(tmpIP));
    LoadStats(playerid);
   
    aInfo[playerid][aLogged] = 0;
   
    if(aInfo[playerid][aRegistered] == 0)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"This name hasn't been registered yet!");
        ShowPlayerDialog(playerid, DIALOG+2, DIALOG_STYLE_INPUT, "Auto register", "Please enter the password u want to choose below", "Proceed", "");
    }
    else
    {
        if(strcmp(tmpIP,aInfo[playerid][aIP],true) == 0)
        {
            SendClientMessage(playerid,COLOR_YELLOW,"|~ You have been automatically logged in with the following stats: ~|");
            SendClientMessage(playerid,COLOR_YELLOW,"|~ Stats ~|");
        }
        else
        {
            SendClientMessage(playerid,COLOR_YELLOW,"|~ Please login to your account. ~|");
            ShowPlayerDialog(playerid, DIALOG+3, DIALOG_STYLE_INPUT, "Login", "Please enter your password", "Proceed", "");
        }
    }
Now when I look at the file where I load all the variables, I can see the IP, and I'm sure that the aIP is the same as the current player IP, but for some reason I don't get the autologin message but the please login message... meaning that the server doesn't compara my IP with the saved IP?


Re: Auto login problem :/ - FUNExtreme - 28.10.2011

Add a debug message to your code that prints the tmpIP and the aInfo[playerid][aIP] value. It might be correct in the file but that doesn't mean it is correct in the comparison!