22.05.2014, 16:49
Hello, So When It Shows The Dialog Register While Connecting To Server (Dialog ID 1) I Register Successfully,But When I Rejoin,And When I Type My Password,It Doesn't Work,And It Says Wrong Password,Codes:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
#pragma unused ret_memcpy
if(dialogid == 1) {
new file[128], name[MAX_PLAYER_NAME], str[128] , ip[12];
GetPlayerIp(playerid, ip, sizeof(ip));
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(file, sizeof(file), "Counter Strike/Users/%s.ini", name);
if(response) {
if(strlen(inputtext)) {
dini_Create(file);
dini_IntSet(file, "Password", num_hash(inputtext));
dini_Set(file, "IP", ip);
format(str, sizeof(str), "You are registered as ~r~%s. Your password is ~r~%s. /changepass to change it", name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
}
else {
Kick(playerid);
}
}
if(dialogid == 2)
{
new file[128], name[MAX_PLAYER_NAME], str[128], ip[12];
GetPlayerIp(playerid, ip, sizeof(ip));
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(str, sizeof(str), "Counter Strike/Users/%s.ini", name);
if(response) {
if(strlen(inputtext)) {
if(num_hash(inputtext) != dini_Int(file, "Password")) {
SendClientMessage(playerid, COLOR_RED, "Wrong Password");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Succesfuly logged in");
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][VIPLevel] = dini_Int(file, "VIPLevel");
GivePlayerMoney(playerid, dini_Int(file, "Cash"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
PlayerInfo[playerid][Kills] = dini_Int(file, "Kills");
PlayerInfo[playerid][Death] = dini_Int(file, "Death");
dini_Set(file, "IP", ip);
}
}
}
else {
Kick(playerid);
}
}
return 1;
}