22.04.2013, 20:48
Ok, im going crazy. Yesterday i spent like 6 hours by fixing/rescripting the account system i have in my server, it works for a while then it gets bugged, players cant register (server creates blank account files) or can't login.
Register/login dialogs:
OnPlayerConnect:
The "path" stock:
Don't tell me to debug, i already did, it prints the normal variables. Any help is appreciated.
EDIT: I noticed that problem fixes when i restart the server, then after some a random number of accounts created (50-100 i think), it starts to create blank account files.
Register/login dialogs:
pawn Код:
if(dialogid == registeraccount)
{
if(!response)
{
SendClientMessage(playerid,red,"You have entered an invalid password.");
ShowPlayerDialog(playerid,registeraccount,DIALOG_STYLE_INPUT,"{FFDD00}Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,registeraccount,DIALOG_STYLE_INPUT,"{FFDD00}Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
if(GetPasswordLevel(inputtext) < 1)
{
SendClientMessage(playerid,red,"Your password level is too low. Use something safe! Try to mix letters with numbers.");
ShowPlayerDialog(playerid,registeraccount,DIALOG_STYLE_INPUT,"{FFDD00}Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
new pyear, pmonth, pday;
new phour, pminute, psecond;
getdate(pyear, pmonth, pday);
gettime(phour, pminute, psecond);
new RegDate[128];
format(RegDate, 128, "%02d:%02d:%02d - %02d/%02d/%d", phour, pminute, psecond, pday, pmonth, pyear);
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"Admin",0);
INI_WriteInt(file,"Cash",0);
INI_WriteInt(file,"Vip",0);
INI_WriteInt(file,"Scores",0);
INI_WriteInt(file,"Deaths",0);
INI_WriteInt(file,"Nopm",0);
INI_WriteInt(file,"Muted",0);
INI_WriteInt(file,"Vip",0);
INI_WriteInt(file,"Banned",0);
INI_WriteInt(file,"Cookies",0);
INI_WriteInt(file,"Warn",0);
INI_WriteString(file,"RegisterDate", RegDate);
INI_WriteInt(file,"Jailed", 0);
INI_WriteInt(file,"Logged", 1);
INI_WriteInt(file,"AdminActions", 0);
INI_WriteInt(file, "Rank", 0);
INI_WriteInt(file,"PingExceeds",0);
INI_WriteInt(file,"TempBan",0);
INI_Close(file);
pInfo[playerid][Admin] = 0;
pInfo[playerid][Cash] = 0;
pInfo[playerid][Vip] = 0;
pInfo[playerid][Scores] = 0;
pInfo[playerid][Deaths] = 0;
pInfo[playerid][Nopm] = 0;
pInfo[playerid][Muted] = 0;
pInfo[playerid][Vip] = 0;
pInfo[playerid][Banned] = 0;
pInfo[playerid][Cookies] = 0;
pInfo[playerid][Warn] = 0;
pInfo[playerid][Jailed] = 0;
pInfo[playerid][Logged] = 1;
pInfo[playerid][AdminActions] = 0;
pInfo[playerid][Rank] = 0;
pInfo[playerid][PingExceeds] = 0;
pInfo[playerid][TempBan] = 0;
SendClientMessage(playerid,-1,"System: Registered and autologged!");
TotalRegister++;
new echo[250];
new kname[24];
GetPlayerName(playerid, kname, 24);
new IP[16];
GetPlayerIp(playerid, IP, 16);
format(echo,sizeof(echo),"0,3System: %s (%d) (IP: %s) has registered a new account - Total Accounts: %d - %02d:%02d:%02d - %02d:%02d:%02d",kname,playerid,IP,TotalRegister,pday,pmonth,pyear,phour,pminute,psecond);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, echo);
SetTimerEx("CheckBan", 1500, false, "i", playerid);
SetTimerEx("CheckTempBan", 1500, false, "i", playerid);
new welcome[170];
format(welcome, sizeof(welcome), "Welcome to Cod Samp, ~r~%s! Type ~r~/rules ~w~and ~r~/cmds ~w~for server info.",kname);
GameTextForPlayer(playerid,welcome,6000,4);
return 1;
}
}
if(dialogid == loginaccount)
{
if(!response)
{
ShowPlayerDialog(playerid,loginaccount,DIALOG_STYLE_INPUT,"{FFDD00}Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
return 1;
}
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, pInfo[playerid][Cash]);
SetPlayerScore(playerid, pInfo[playerid][Scores]);
pInfo[playerid][Logged] = 1;
SetPlayerWantedLevel(playerid, pInfo[playerid][Rank]);
new kname[24];
GetPlayerName(playerid, kname, 24);
new welcome1[128];
format(welcome1, sizeof(welcome1), "Welcome back ~r~%s!",kname);
GameTextForPlayer(playerid,welcome1,5000,4);
SetTimerEx("CheckBan", 1500, false, "i", playerid);
SetTimerEx("CheckTempBan", 1500, false, "i", playerid);
new string[150];
format(string,sizeof(string),"System: Logged in as {F70505}%s {FFFFFF}- Level: {F70505}%d",AdminLevelToName(playerid),pInfo[playerid][Admin]);
SCM(playerid,-1,string);
new lll[200];
format(lll, sizeof(lll), "%s (%d) - %s (%d)", RankName(playerid),pInfo[playerid][Rank],AdminLevelToName(playerid),pInfo[playerid][Admin]);
Update3DTextLabelText(RankLabel[playerid], GetTeamColor(playerid), lll);
Attach3DTextLabelToPlayer(RankLabel[playerid], playerid, 0.0, 0.0, 0.6);
}
else
{
ShowPlayerDialog(playerid,loginaccount,DIALOG_STYLE_INPUT,"{FFDD00}Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
new Year, Month, Day, Hour, Minute, Second;
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
new echo[270];
new kname[24];
GetPlayerName(playerid, kname, 24);
new IP[16];
GetPlayerIp(playerid, IP, 16);
format(echo,sizeof(echo),"0,3%s (%d) (IP: %s) failed to login in his account - %02d:%02d:%02d - %02d:%02d:%02d",kname,playerid,IP,Day,Month,Year,Hour,Minute,Second);
FailedLogins(echo);
return 1;
}
}
}
pawn Код:
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,loginaccount,DIALOG_STYLE_INPUT,"{FFDD00}Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,registeraccount,DIALOG_STYLE_INPUT,"{FFDD00}Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}
pawn Код:
stock Path(playerid)
{
new str[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),UserPath,name);
return str;
}
EDIT: I noticed that problem fixes when i restart the server, then after some a random number of accounts created (50-100 i think), it starts to create blank account files.