big problems with accounts
#9

Quote:
Originally Posted by maramizo
Посмотреть сообщение
pawn Код:
new IP[16];
GetPlayerIp(playerid,IP,16);
INI_WriteInt(File, "Ip", IP[playerid]);
TO
pawn Код:
new IP[MAX_PLAYERS];
GetPlayerIp(playerid,IP,MAX_PLAYERS);
INI_WriteInt(File, "Ip", IP[playerid]);
There's no reason at all to make IP a player-array.

In the OP, it was just a single line being incorrect, and that was the writing line. He declared IP as a 16-cell array; which is the largest an IP can be, and he set it to 'playerid's IP; which is correct. He was trying to do 'IP[playerid]' when in reality, IP was only a string var. He was also trying to write the string variable 'IP' into the player file as an integer - which also is incorrect.

HOW TO FIX: Change this
pawn Код:
INI_WriteInt(File, "Ip", IP[playerid]);
to this
pawn Код:
INI_WriteString(File, "Ip", IP);
Edit: In the original code, there's a declaration of a variable called plrIP which is used to get the players IP once again. This is highly unnecessary. String variables are declared with a cell-size of 250 which is too damn much.

I suggest trying this code:
pawn Код:
case DIALOG_REGISTER:
        {
            if(!response)
            {
            ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","{FF0000}You have entered an invalid password.\n""Type your password below to register a new account.","Register","Quit");
            }
            if(response)
            {
                new Year, Month, Day, Hour, Minute, Second;
                getdate(Year, Month, Day);
                gettime(Hour, Minute, Second);
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                new IP[16];
                GetPlayerIp(playerid,IP,16);
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",1500);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"NoPm",0);
                INI_WriteInt(File,"Mute",0);
                INI_WriteInt(File,"Vip",0);
                INI_WriteInt(File,"C4",0);
                INI_WriteInt(File,"Banned",0);
                INI_WriteInt(File,"Cookies",0);
                INI_WriteInt(File,"Warn",0);
                INI_WriteInt(File, "RegisterDate_day", Day);
                INI_WriteInt(File, "RegisterDate_mon", Month);
                INI_WriteInt(File, "RegisterDate_year",Year);
                INI_WriteInt(File, "RegisterDate_hour",Hour);
                INI_WriteInt(File, "RegisterDate_min", Minute);
                INI_WriteInt(File, "RegisterDate_sec", Second);
                INI_WriteInt(File, "Ip", IP[playerid]);
                INI_WriteInt(File, "Min", 0);
                INI_WriteInt(File, "Hour", 0);
                INI_WriteInt(File, "Sec", 0);
                INI_WriteInt(File, "Jailed", 0);
                INI_WriteInt(File, "Logged", 1);
                INI_WriteInt(File, "AdminActions", 0);
                INI_WriteInt(File, "Rank", 0);
                INI_Close(File);
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
                SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
                SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pRank]);
                SCM(playerid,-1,"{F70505}Registered and autologged! {FF0000}Now all your data are auto saved.");
                TotalRegister++;
                new msg[128], name[MAX_PLAYER_NAME];
                getdate(Year, Month, Day);
                gettime(Hour, Minute, Second);
                GetPlayerName(playerid, name, sizeof(name));
                format(msg, sizeof(msg), "4%s (%d) has registered a new account on Cod Samp - Ip: %s - %02d/%02d/%d - %02d:%02d:%02d - Total Accounts: %d", name, playerid,IP,Day,Month,Year,Hour,Minute,Second,TotalRegister);
                IRC_GroupSay(gGroupID, IRC_ACHANNEL, msg);
                format(msg, sizeof(msg), "%s (%d) has registered a new account on Cod Samp - Ip: %s - %02d/%02d/%d - %02d:%02d:%02d - Total Accounts: %d", name, playerid,IP,Day,Month,Year,Hour,Minute,Second,TotalRegister);
                AccountsLog(msg);
                format(LastAccount,sizeof(LastAccount),"%s (%d) has registered a new account on Cod Samp - Ip: %s - %02d/%02d/%d - %02d:%02d:%02d - Total Accounts: %d",  name, playerid,IP,Day,Month,Year,Hour,Minute,Second,TotalRegister);
            }
Reply


Messages In This Thread
big problems with accounts - by Face9000 - 12.12.2012, 19:06
Re: big problems with accounts - by park4bmx - 12.12.2012, 19:48
Re: big problems with accounts - by thefatshizms - 12.12.2012, 21:44
Re: big problems with accounts - by Face9000 - 12.12.2012, 22:11
Re: big problems with accounts - by Jefff - 13.12.2012, 01:22
Re: big problems with accounts - by Face9000 - 13.12.2012, 07:49
Re: big problems with accounts - by Face9000 - 13.12.2012, 21:20
Re: big problems with accounts - by maramizo - 14.12.2012, 00:59
Re: big problems with accounts - by LarzI - 14.12.2012, 01:10
Re: big problems with accounts - by maramizo - 14.12.2012, 02:12

Forum Jump:


Users browsing this thread: 3 Guest(s)