public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case DIALOG_REG: { if(!response) { PlayerInfo[playerid][pLoginAttempts]++; if(PlayerInfo[playerid][pLoginAttempts] > MAX_LOGIN_FAIL)return KickEx(playerid, "ERRORE: Superato limite di tentavi Login"); return ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "Registrazione", "ERRORE: La registrazione и obbligatoria.\nInserisci una password per registrarti", "Conferma", ""); } if(strlen(inputtext) < MIN_LENGHT_PASS || strlen(inputtext) > MAX_LENGHT_PASS) { PlayerInfo[playerid][pLoginAttempts]++; if(PlayerInfo[playerid][pLoginAttempts] > MAX_LOGIN_FAIL)return KickEx(playerid, "ERRORE: Superato limite di tentavi Login"); format(tstring, sizeof(tstring), "ERRORE: Devi inserire una password compresa tra %d e %d caratteri.\nInserisci una password per registrarti", MIN_LENGHT_PASS, MAX_LENGHT_PASS); return ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "Registrazione", tstring, "Conferma", ""); } RegisterPlayer(playerid, inputtext); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Bentornato!\nDigita la tua password per effettuare il login", "Conferma", ""); }
stock RegisterPlayer(playerid, password[]) { dfile_Create(PlayerFile(playerid)); SavePlayerPass(playerid, password); GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16); PlayerInfo[playerid][pPos][0] = -188.655105; PlayerInfo[playerid][pPos][1] = 941.477600; PlayerInfo[playerid][pPos][2] = 15.380722; PlayerInfo[playerid][pPos][3] = 355.891571; PlayerInfo[playerid][pInterior] = 0; PlayerInfo[playerid][pWorld] = 0; PlayerInfo[playerid][pLevel] = 1; PlayerInfo[playerid][pAdminLevel] = 0; PlayerInfo[playerid][pExp] = 0; PlayerInfo[playerid][pMoney] = 500; PlayerInfo[playerid][pSkin] = 1; for(new i; i<4; i++) { PlayerInfo[playerid][pPos][i] = 0.0; } PlayerInfo[playerid][pHP] = 100; PlayerInfo[playerid][pAP] = 0; PlayerInfo[playerid][pBanned] = false; format(PlayerInfo[playerid][pBannedReason], MAX_BAN_REASON, ""); SavePlayer(playerid); }
Can i have a look at the "SavePlayerPass(playerid, password);" function?
And does the login dialog show up before it crashes ? Or does it crash before that happens ? |
stock SavePlayerPass(playerid, password[]) { dfile_Open(PlayerFile(playerid)); dfile_WriteString("Password", password); dfile_SaveFile(); dfile_CloseFile(); return 1; }