14.12.2012, 01:10
Quote:
pawn Код:
pawn Код:
|
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]);
pawn Код:
INI_WriteString(File, "Ip", IP);
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);
}