12.01.2013, 14:30
Alright, once again I am having an issue with my YINI login system, basically regardless of what password you input it says the password is incorrect, here is my coding:
Any and all help will be appreciated, especially being this must be fixed before I may continue.
Kind regards,
~Nmader
pawn Код:
public loadaccount_user(playerid, name[], value[])
{
INI_String("Password", pInfo[playerid][Pass],129);
INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
INI_Int("Money",pInfo[playerid][Money]);
INI_Int("Scores",pInfo[playerid][Scores]);
INI_Int("Kills",pInfo[playerid][Kills]);
INI_Int("Deaths",pInfo[playerid][Deaths]);
INI_Int("Faction",pInfo[playerid][Faction]);
INI_Int("FactionRank",pInfo[playerid][FactionRank]);
INI_Int("Skin",pInfo[playerid][Skin]);
INI_Int("BankMoney",pInfo[playerid][BankMoney]);
INI_Int("Level",pInfo[playerid][Level]);
INI_Int("Experience",pInfo[playerid][Experience]);
INI_Int("TutorialTaken",pInfo[playerid][TutorialTaken]);
INI_Int("SpawnSelection",pInfo[playerid][SpawnSelection]);
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(fexist(Path(playerid)))
{
new INI:file = INI_Open(Path(playerid));
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
INI_WriteInt(file,"Faction",pInfo[playerid][Faction]);
INI_WriteInt(file,"FactionRank",pInfo[playerid][FactionRank]);
INI_WriteInt(file,"Skin",pInfo[playerid][Skin]);
INI_WriteInt(file,"BankMoney",pInfo[playerid][Skin]);
INI_WriteInt(file,"Level",pInfo[playerid][Level]);
INI_WriteInt(file,"Expereience",pInfo[playerid][Experience]);
INI_WriteInt(file,"TutorialTaken",pInfo[playerid][TutorialTaken]);
INI_WriteInt(file,"SpawnSelection",pInfo[playerid][SpawnSelection]);
INI_Close(file);
return 1;
}
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == dregister)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"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 plrIP[16];
new string[128];
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"AdminLevel",0);
INI_WriteInt(file,"VIPLevel",0);
INI_WriteInt(file,"Money",1500);
INI_WriteInt(file,"Scores",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Deaths",0);
INI_WriteInt(file,"Faction",0);
INI_WriteInt(file,"FactionRank",0);
INI_WriteInt(file,"Skin",26);
INI_WriteInt(file,"BankMoney",2500);
INI_WriteInt(file,"Level",1);
INI_WriteInt(file,"Experience",0);
INI_WriteInt(file,"TutorialTaken",0);
INI_WriteInt(file,"SpawnSelection",1);
INI_Close(file);
format(string, sizeof(string), "You have registered! [IP: %d] [PING: %d]", GetPlayerIp(playerid, plrIP, sizeof(plrIP)) , GetPlayerPing(playerid));
SendClientMessage(playerid, 0x02D8FDFF, string);
if(pInfo[playerid][Faction] >= 1)
{
format(string, sizeof(string), "Administrative Level: %d | Faction: %d (Rank %d) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
SendClientMessage(playerid, 0x02D8FDFF, string);
format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
SendClientMessage(playerid, 0x02D8fDFF, string);
}
else
{
format(string, sizeof(string), "Administrative Level: %d | Faction: Civilian (N/A) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
SendClientMessage(playerid, 0x02D8FDFF, string);
format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
SendClientMessage(playerid, 0x02D8fDFF, string);
}
return 1;
}
}
if(dialogid == dlogin)
{
if(!response) return Kick(playerid);
if(response)
{
new string[128];
new plrIP[999];
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
pInfo[playerid][Authenticated] = 1;
TogglePlayerSpectating(playerid, false);
format(string, sizeof(string), "You have successfully logged in! [IP: %d] [PING: %d]", GetPlayerIp(playerid, plrIP, sizeof(plrIP)) , GetPlayerPing(playerid));
SendClientMessage(playerid, 0x02D8FDFF, string);
pInfo[playerid][Authenticated] = 1;
if(pInfo[playerid][Faction] >= 1)
{
format(string, sizeof(string), "Administrative Level: %d | Faction: %d (Rank %d) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
SendClientMessage(playerid, 0x02D8FDFF, string);
format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
SendClientMessage(playerid, 0x02D8fDFF, string);
}
else
{
format(string, sizeof(string), "Administrative Level: %d | Faction: Civilian (N/A) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
SendClientMessage(playerid, 0x02D8FDFF, string);
format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
SendClientMessage(playerid, 0x02D8fDFF, string);
}
if(pInfo[playerid][SpawnSelection] == 1)
{
SetPlayerPos(playerid, -2485.8848,2224.3340,4.8480);
SpawnPlayer(playerid);
}
SetCameraBehindPlayer(playerid);
INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
SetPlayerScore(playerid,pInfo[playerid][Scores]);
SetPlayerSkin(playerid,pInfo[playerid][Skin]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
}
else
{
new IncorrectPasswords;
if(IncorrectPasswords < 3)
{
format(string, sizeof(string), "Welcome back, {0D72EE}%s!{FFFFFF} \nPlease enter your password below to login to your account.", RPName(playerid));
INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login",string,"Login","Quit");
SendClientMessage(playerid, 0x8F8F8FFF, "ERROR: You have inserted an invalid password!");
IncorrectPasswords ++;
return 1;
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "SERVER: You have been kicked for the following reason: Multiple failed login attempts.");
Kick(playerid);
return 1;
}
}
}
}
return 1;
}
Kind regards,
~Nmader