22.02.2011, 23:49
Код:
if (dialogid == 1) { new name[MAX_PLAYER_NAME], file[256], string[128], buf[129]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{CCFFDD}You are registered", "{CCFFDD}Type your password below", "{FF6347}Login", "{FF6347}Quit"); WP_Hash(buf,sizeof(buf),(inputtext)); new INI:Acc = INI_Open(file); INI_WriteString(Acc,"Password", buf); INI_WriteInt(Acc,"Regged",1); INI_WriteInt(Acc,"Level",0); INI_WriteInt(Acc,"Score",0); INI_WriteInt(Acc,"Cash",0); INI_Close(Acc); format(string,sizeof(string),"You have successfully registered with the password: %s", inputtext); SendClientMessage(playerid, limegreen, string); PInfo[playerid][Regged] = 1; } if(dialogid == 2) { new name[MAX_PLAYER_NAME], file[256], string[128]; GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),SERVER_USER_FILE, name); if(!response) return Kick(playerid); if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit"); new tmp; tmp = INI_Int(file, "Password"); if(WP_Hash(inputtext) = !tmp) { SendClientMessage(playerid,red,"ERROR: Wrong Password!"); ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit"); } else { PInfo[playerid][Logged] = 1; PInfo[playerid][Level] = INI_Int(file,"Level"); SetPlayerScore(playerid,PInfo[playerid][Score]); GivePlayerMoney(playerid,PInfo[playerid][Cash]); SendClientMessage(playerid,limegreen,"You have successfully logged in!"); }