20.01.2019, 15:29
You do the saving in SaveUserStats, by using the MySQL UPDATE Query. %d is for numbers, %s is for strings.
You messed up the code a little bit, it will not work like this anymore.
Do the following:
Add to the enum:
OnPlayerConnect:
And the two Dialogs to:
Then it should work like you want it.
You messed up the code a little bit, it will not work like this anymore.
Do the following:
Add to the enum:
Code:
pPassTmp[128],
Code:
format(PlayerInfo[playerid][pPassTmp], 128, "");
Code:
if(dialogid == DIALOG_REGISTER) { //Se il giocatore seleziona Annulla/Esci if(!response) return Kick(playerid); //In tal caso l'utente inserisci una password troppo breve o non inserisce niente ritorna sullo stesso dialogo if(strlen(inputtext) < 3) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registrazione", "{FF0000}ERRORE:\n{000000}Hai inserito una password troppo corta\n{00FF00}Consiglio: Usa almeno 3 caratteri ed una password sicura!", "Continua", "Annulla"); //Se va tutto bene inizierа a creare il giocatore nel database //MD5 и il protocollo di criptografia per la password (puoi anche rimuoverlo dalla stringa lasciandolo: ('%e', '%e') new infopass[145]; format(infopass, sizeof(infopass), "{f8ff33}[INFO:]{00FF00} La tua password sarа: %s - puoi cambiarla con /cambiapassword", inputtext); SendClientMessage(playerid, 0xFFFFFF, infopass); format(PlayerInfo[playerid][pPassTmp], 128, inputtext); //Dopo di chи la query viene inviata e passa al dialogo successivo // email ShowPlayerDialog(playerid, DIALOG_REGISTER_EMAIL, DIALOG_STYLE_INPUT, "Registrazione", "{00FF00}Non manca molto:\n{000000}Inserisci una email per continuare\n{00FF00}INFO: Serve per proteggere il tuo account!", "Continua", "Annulla"); return 1; } if(dialogid == DIALOG_REGISTER_EMAIL) { //Se il giocatore seleziona Annulla/Esci if(!response) return Kick(playerid); //In tal caso l'utente inserisci una password troppo breve o non inserisce niente ritorna sullo stesso dialogo if(strlen(inputtext) < 5) return ShowPlayerDialog(playerid, DIALOG_REGISTER_EMAIL, DIALOG_STYLE_PASSWORD, "Registrazione", "{FF0000}ERRORE:\n{000000}Devi inserire una mail valide\n{00FF00}INFO: Servirа per proteggere meglio il tuo account!", "Continua", "Annulla"); format(PlayerInfo[playerid][pEmail], 64, inputtext); //Dopo di chи la query viene inviata e passa al dialogo successivo // etа new query[256]; mysql_format(handle, query, sizeof(query), "INSERT INTO users (name, password, email) VALUES ('%e', MD5('%e'), '%e')", PlayerInfo[playerid][pName], PlayerInfo[playerid][pPassTmp], inputtext); mysql_pquery(handle, query, "OnUserRegister", "d", playerid); format(PlayerInfo[playerid][pPassTmp], 128, ""); return 1; }