Auto-IP Login Not Working - Please I beg Help
#1

Hello,
I finished making my Adminscript from a Base script which included IP Login. But, It doesnt work. Anybody can log onto anybodies account. It would say *IP Recognized - Successfully Logged In* But it doesnt work. If i registered, anybody can enter with my name and it'll work, It would show them that The IP is recognized but its lying. I think it isnt writing the IP in scriptfiles and Users folder with the players ini's. Please somebody help!

pawn Код:
forward LoadUserData(playerid,name[],value[]);
    forward OnPlayerRegister(playerid,password[]);
    forward OnPlayerLogin(playerid,password[]);
    native WP_Hash(buffer[],len,const str[]);
    new muted[MAX_PLAYERS];
    new PlayerIP[64][MAX_PLAYERS];
    #define version "0.1"
    #define DIALOG_REGISTER 1
    #define DIALOG_LOGIN 2
   
    #undef MAX_PLAYERS
    #define MAX_PLAYERS 50  // Here you need to set the maximum number of players able to play on your server at any given time, I'll put 32 because that's the max players on my server.
    #define Grey 0xC0C0C0FF // Defining the color 'Grey'

    new String[128], Float:SpecX[MAX_PLAYERS], Float:SpecY[MAX_PLAYERS], Float:SpecZ[MAX_PLAYERS], vWorld[MAX_PLAYERS], Inter[MAX_PLAYERS];
    new IsSpecing[MAX_PLAYERS], Name[MAX_PLAYER_NAME], IsBeingSpeced[MAX_PLAYERS],spectatorid[MAX_PLAYERS];

    enum PlayerInfo
    {
            Password[129],
            Admin,
            Score,
            Cash,
            Deaths,
            Kills,
            IP[64]
    }
    new pInfo[MAX_PLAYERS][PlayerInfo];


    /* Callbacks */
    public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
    {
            if(dialogid == DIALOG_REGISTER)
            {
                if(isnull(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","You Are {FF0000}Not {FFFFFF}Registered - Please Register","Register","Quit");
                OnPlayerRegister(playerid,inputtext);
            }
            if(dialogid == DIALOG_LOGIN)
            {
                if(isnull(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","You Are {80FF00}Registered {FFFFFF}Please Type Your Password Below To Login","Login","Quit");
                OnPlayerLogin(playerid,inputtext);
            }
            return 1;
    }

    public OnPlayerConnect(playerid)
    {
            new pFile[64],pName[24],pIP[64],string[124];
            GetPlayerIp(playerid,pIP,64);
            PlayerIP[playerid] = pIP;
            GetPlayerName(playerid,pName,sizeof(pName));
            format(pFile,sizeof(pFile),"Users/%s.ini",pName);
            muted[playerid] = 0;
            if(fexist(pFile))
            {
                INI_ParseFile(pFile,"LoadUserData",.bExtra = true,.extra = playerid);
                if(!strcmp(pIP,pInfo[playerid][IP]))
                {
                            SetPlayerScore(playerid,pInfo[playerid][Score]);
                            GivePlayerMoney(playerid,pInfo[playerid][Cash]);
                            SendClientMessage(playerid,-1,"{FF00FF}You Have Been Auto-Logged In Successfully - IP Match");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","You Are {80FF00}Registered {FFFFFF}Please Type Your Password Below To Login","Login","Quit");
                        format(string,sizeof(string),"{00FFFF}Welcome Back %s! Your Previous IP Was - %s.",pName,pInfo[playerid][IP]);
                        SendClientMessage(playerid,-1,string);
                    }
            }
            else
            {
                ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Quit");
            }
            return 1;
    }

    public LoadUserData(playerid,name[],value[])
    {
        INI_String("Password",pInfo[playerid][Password],129);
        INI_Int("Admin",pInfo[playerid][Admin]);
        INI_Int("Score",pInfo[playerid][Score]);
        INI_Int("Cash",pInfo[playerid][Cash]);
        INI_Int("Deaths",pInfo[playerid][Deaths]);
        INI_Int("Kills",pInfo[playerid][Kills]);
        INI_Int("IP",pInfo[playerid][IP]);
        return 1;
    }

    public OnPlayerRegister(playerid,password[])
    {
            new hashed[129],pFile[64],pName[24],string[124],pIP[64];
            GetPlayerName(playerid,pName,sizeof(pName));
            GetPlayerIp(playerid,pIP,64);
            format(pFile,sizeof(pFile),"Users/%s.ini",pName);
            WP_Hash(hashed,129,password);
            new INI:PlayerFile = INI_Open(pFile);
            INI_WriteString(PlayerFile,"Password",hashed);
            INI_WriteInt(PlayerFile,"Admin",0);
            INI_WriteInt(PlayerFile,"Score",0);
            INI_WriteInt(PlayerFile,"Cash",0);
            INI_WriteInt(PlayerFile,"Deaths",0);
            INI_WriteInt(PlayerFile,"Kills",0);
            INI_WriteInt(PlayerFile,"IP",0);
            INI_Close(PlayerFile);
            format(string,sizeof(string),"%s has registered an account.");
            print(string);
            return 1;
    }

    public OnPlayerLogin(playerid,password[])
    {
            if(strcmp(password,pInfo[playerid][Password]))
            {
            ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Password incorrect.\nPlease enter a password.","Login","Quit");
            }
            else
            {
                    SetPlayerScore(playerid,pInfo[playerid][Score]);
                    GivePlayerMoney(playerid,pInfo[playerid][Cash]);
            }
            return 1;
    }

    public OnPlayerDisconnect(playerid,reason)
    {
        new pFile[124],pName[124],pIP[64];
        PlayerIP[playerid] = pIP;
        GetPlayerName(playerid,pName,sizeof(pName));
        format(pFile,sizeof(pFile),"Users/%s.ini",pName);
        new INI:PlayerFile = INI_Open(pFile);
        INI_WriteString(PlayerFile,"Password",pInfo[playerid][Password]);
        INI_WriteInt(PlayerFile,"Admin",pInfo[playerid][Admin]);
        INI_WriteInt(PlayerFile,"Score",GetPlayerScore(playerid));
        INI_WriteInt(PlayerFile,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(PlayerFile,"Deaths",pInfo[playerid][Deaths]);
        INI_WriteInt(PlayerFile,"Kills",pInfo[playerid][Kills]);
        INI_WriteInt(PlayerFile,"pIP",pInfo[playerid][IP]);
        INI_Close(PlayerFile);
        if(IsBeingSpeced[playerid] == 1)//If the player being spectated, disconnects, then turn off the spec mode for the spectator.
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);// This justifies what's above, if it's not off then you'll be either spectating your connect screen, or somewhere in blueberry (I don't know why)
            }
        }
    }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)