Please help with Administration system...
#11

well that script is a complete mess. You Auto log them in by using their ip, but for some reason you check their password. Hmm?

Also, I\'m a little confused. You\'re saving the files as .djson ? Wouldn\'t it make more sense to save them as .ini? And I checked the rest of your script, it\'s saving it as .ini, thats probably why it wont auto log you in as there is a file called (yourname).ini, but not one called (yourname).djson.

anyway here it is:
pawn Code:
public OnPlayerConnect(playerid)
{//New\'s
    new string[256];
    new PNAME[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PNAME, sizeof(PNAME));
    //PlayerInfo == 0
    PlayerInfo[playerid][pLevel] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pCash] = 0;
    gPlayerAccount[playerid] = 0;
    gPlayerLogged[playerid] = 0;
    //Connect Message
    format(string, sizeof(string), "***%s has joined the server.", PNAME);
    SendClientMessageToAll(0xAAAAAAAA, string);
    //Does Account Exist?
    format(string, sizeof(string), "Admin/Users/%s.ini", PNAME);
    if(fexist(string))
    {
      gPlayerAccount[playerid] = 1;
      //IP Checker
        new IP[20];
        new IP2[20]=dini_Get(string,"IP");
        GetPlayerIp(playerid,IP,sizeof(IP));
        if(strcmp(IP,IP2,true)==0)
        {
            new key[256] , val[256];
            new Data[256];
            while (fread(string,Data,sizeof(Data)))
            {
                key = ini_GetKey( Data );
                if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
                if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
                if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
                if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
            }
            fclose(UserFile);
            gPlayerLogged[playerid] = 1;
            format(string, sizeof(string), "[SUCESS]%s, you have been automatically logged in.", PNAME);
            SendClientMessage(playerid, COLOR_GREEN, string);
        }
        else
        {
            format(string, sizeof(string), "[SERVER]Welcome back %s! Please login.", PNAME);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
    }
    else
    {
        format(string, sizeof(string),"[SERVER]Account %s isn\'t registered. Register using /register password",PNAME);
        SendClientMessage(playerid, COLOR_YELLOW,string);
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Please help with Administration system... - by AiVAMAN - 15.05.2009, 12:19
Re: Please help with Administration system... - by Ignas1337 - 15.05.2009, 14:00
Re: Please help with Administration system... - by AiVAMAN - 15.05.2009, 14:31
Re: Please help with Administration system... - by member - 15.05.2009, 14:53
Re: Please help with Administration system... - by AiVAMAN - 15.05.2009, 14:55
Re: Please help with Administration system... - by member - 15.05.2009, 15:00
Re: Please help with Administration system... - by Andom - 15.05.2009, 15:02
Re: Please help with Administration system... - by AiVAMAN - 17.05.2009, 07:58
Re: Please help with Administration system... - by Think - 17.05.2009, 08:37
Re: Please help with Administration system... - by AiVAMAN - 17.05.2009, 08:43
Re: Please help with Administration system... - by Badger(new) - 17.05.2009, 13:02
Re: Please help with Administration system... - by AiVAMAN - 17.05.2009, 16:21
Re: Please help with Administration system... - by AiVAMAN - 21.05.2009, 12:17
Re: Please help with Administration system... - by Badger(new) - 21.05.2009, 13:50
Re: Please help with Administration system... - by AiVAMAN - 23.05.2009, 07:03
Re: Please help with Administration system... - by v0nz - 23.05.2009, 07:48
Re: Please help with Administration system... - by Badger(new) - 23.05.2009, 13:44
Re: Please help with Administration system... - by AiVAMAN - 25.05.2009, 18:21
Re: Please help with Administration system... - by AiVAMAN - 26.05.2009, 17:17

Forum Jump:


Users browsing this thread: 6 Guest(s)