27.11.2011, 20:49
There's something wrong with this code, but i'm just overseeing it. It's giving me an invalid password error, even if the password is correct; Here is the code:
pawn Код:
else if(dialogid == DIALOG_JOIN)
{
if(response)
{
new string2[256];
format(string, sizeof(string), "Welcome to %s | V: %s!", SCRIPT_MODE, SCRIPT_VERSION);
format(string2, sizeof(string2), "In order to play on our server, we require you create an account.\nYou may be asking yourself, why do I have to create an account? The answer would be: Security.\nWe strive to provide a completely secure SA:MP experience! Please enter a password below:");
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_JOIN, DIALOG_STYLE_INPUT, string, string2, "Join", "Leave");
new INI:File = INI_Open(FindUserPath(playerid));
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
INI_SetTag(File,"DATA");
INI_WriteInt(File,"Password", udb_hash(inputtext));
INI_WriteString(File, "IP", plrIP);
INI_WriteInt(File,"Money", 0);
INI_WriteInt(File,"AuthLevel", 0);
INI_WriteInt(File,"Kills", 0);
INI_WriteInt(File,"Deaths", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 119, 0, 0, 0, 0, 24, 99999, 31, 99999, 34, 99999);
SpawnPlayer(playerid);
}
else
{
SendClientMessage(playerid, COLOR_SUCCESSFUL, "[System] You have been booted from the server. (Clicked \"Leave\" or closed the dialog!)");
return Kick(playerid);
}
}
else if(dialogid == DIALOG_LOGIN)
{
if(response)
{
if(udb_hash(inputtext) == UserInfo[playerid][Password])
{
INI_ParseFile(FindUserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
format(string, sizeof(string), "AuthLevel: %d", UserInfo[playerid][AuthLevel]);
SendClientMessage(playerid, -1, string);
return 1;
}
else
{
SendClientMessage(playerid, -1, "Invalid Password!");
return 1;
}
}
return 1;
}