22.01.2018, 17:55
Doesn't work, and by the way when I put a password in the register dialog nothing happens it just reappears again and again, and when I relog it shows login dialog it says wrong password for w/e pass I use..
heres the edited code
heres the edited code
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == dialogregister) { if(!response) return Kick(playerid); if(response) { ShowPlayerDialog(playerid, dialogregister, DIALOG_STYLE_INPUT, "Server", "Welcome to LSDB!\nThis account is NOT registered\nPlease insert your password below in order to create an account.", "Register", "Quit"); return 1; } new hashpass[129]; WP_Hash(hashpass, sizeof(hashpass), inputtext); new INI:file = INI_Open(Path(playerid)); INI_SetTag(file, "Player Information"); INI_WriteString(file, "Password", hashpass); INI_WriteInt(file, "AdminLevel", 0); INI_WriteInt(file, "Money", 100); INI_WriteInt(file, "Score", 0); INI_WriteInt(file, "Kills", 0); INI_WriteInt(file, "Deaths", 0); INI_Close(file); SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have successfully registered an account!"); return 1; } if(dialogid == dialoglogin) { if(!response) return Kick(playerid); if(response) { new hashpass[129]; WP_Hash(hashpass, sizeof(hashpass), inputtext); if(!strlen(inputtext)) return ShowPlayerDialog(playerid, dialoglogin, DIALOG_STYLE_INPUT, "Server", "{FF0000}You have entered an invalid password!\nPlease retry again.","Login","Quit"); { INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid); SetPlayerScore(playerid, pInfo[playerid][Score]); GivePlayerMoney(playerid, pInfo[playerid][Money]); SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have successfully logged in! You can start playing now."); } { ShowPlayerDialog(playerid, dialoglogin, DIALOG_STYLE_INPUT, "Server", "{FF0000}You have entered an invalid password!\nPlease retry again.","Login","Quit"); return 1; } } } return 1; }