12.06.2014, 16:59
Hi.
I'm currently working on my registering system.
I do a query to save the player data into the database and then showing him up a dialog to input his mail, but the dialog doesn't show up.
So I tried to my code and the "printf" which are into the callback (OnPlayerRegister) doesn't display.
Here's my code
And here's my server_log :
Note that I use twice "OnPlayerRegister". The first time is when the player really registers. The other time is when the player inputs his e-mail.
Thanks in advance, because I really don't see what's wrong.
I'm currently working on my registering system.
I do a query to save the player data into the database and then showing him up a dialog to input his mail, but the dialog doesn't show up.
So I tried to my code and the "printf" which are into the callback (OnPlayerRegister) doesn't display.
Here's my code
PHP код:
// under OnDialogResponse
case DIALOG_REGISTER:
{
if(!response)
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Inscription", "Vous devez avoir un compte crйй pour jouer. Entrez le mot de passe voulu dans le champ ci-dessous.", "Ok", "Retour");
return 1;
}
if(strlen(inputtext) <= 3)
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Inscription", "Le mot de passe entrй est trop court ! Il doit faire au minimum 4 caractиres.", "Ok", "Retour");
return 1;
}
new salt[9], strc[80], ip[17], date[6];
printf("Begin : register");
random_string(8, salt);
printf("Random salt created : %s", salt);
strcat(strc, inputtext);
printf("Inputted password inserted into strc : %s", inputtext);
strcat(strc, ".");
printf("Dot inserted into strc, strc = %s", strc);
strcat(strc, salt);
printf("Salt inserted into strc, strc = %s", strc);
GetPlayerIP(playerid, ip, sizeof(ip));
printf("IP Gotten : %s", ip);
getdate(date[0], date[1], date[2]);
gettime(date[3], date[4], date[5]);
printf("Date gotten : %d/%d/%d | %d-%d-%d", date[0], date[1], date[2], date[3], date[4], date[5]);
WP_Hash(PlayerInfo[playerid][pPass], 129, strc);
printf("strc hashed : %s ----> %s", strc, PlayerInfo[playerid][pPass]);
mysql_format(MySQL, query, sizeof(query), "INSERT INTO Joueurs VALUES(NULL, '%s', '%s', NULL, '1', '0', '0', '0.0', '0.0', 0.0', '-1', '-1', '0.0', '0.0', '0.0', '0', '0', NULL, '%s', '%d-%d-%d %d:%d:%d', '%s')",
PlayerInfo[playerid][pName], PlayerInfo[playerid][pPass], salt, date[0], date[1], date[2], date[3], date[4], date[5], ip);
printf("Query formatted !");
mysql_tquery(MySQL, query, "OnPlayerRegister", "ii", playerid, 1);
printf("Query launched !");
return 1;
}
// At the bottom of my script
public OnPlayerRegister(playerid, step)
{
printf("Called callback OnPlayerRegister");
if(step == 1)
{
printf("Entering step 1");
if(cache_affected_rows() > 0) printf("Showing dialog"), ShowPlayerDialog(playerid, DIALOG_INPUTMAIL, DIALOG_STYLE_INPUT, "E-mail", "Votre enregistrement dans notre base de donnйes a йtй fait avec succиs. Veuillez maintenant renseigner votre adresse mail de contact. Elle\nrestera privйe et ne sera utilisйe qu'en cas de perte de votre compte InGame pour rйinitialiser votre mot de passe.", "Ok", "Retour");
else KickWithMessage(playerid, -1, "{FF0000}[Erreur]{FFFFFF} Il y a eu un problиme d'enregistrement dans notre base de donnйes. Vous avez йtй dйconnectй par mesure de sйcuritй. Veuillez vous reconnecter et rйessayer.", "Ok", "Retour");
}
else if(step == 2)
{
printf("Entering step 2");
new dialog_display[256];
printf("Creating the dialog display");
if(cache_affected_rows() > 0) printf("Successfuly registered e-mail !"), strcat(dialog_display, "Votre adresse mail a йtй enregistrйe correctement dans la base de donnйes. Veuillez maintenant vous\nconnecter avec le mot de passe entrй prйcedemment.");
else printf("Fail during registering the email"), strcat(dialog_display, "Il y a eu un problиme avec l'enregistrement de votre adresse e-mail dans notre base de donnйes. Vous pouvez malgrй tout commencer а jouer.\nNous vous conseillons toutefois d'informer le staff de ce problиme, afin de ne pas perdre dйfinitivement votre compte en cas de soupзons de piratage.");
printf("Showing the dialog");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Connexion", dialog_display, "Ok", "Retour");
}
return 1;
}
Код:
[19:13:16] registering step [19:13:27] Begin : register [19:13:27] Random salt created : GfbNF6LS [19:13:27] Inputted password inserted into strc : azsd [19:13:27] Dot inserted into strc, strc = azsd. [19:13:27] Salt inserted into strc, strc = azsd.GfbNF6LS [19:13:27] IP Gotten : 25.76.71.74 [19:13:27] Date gotten bitch : 2014/6/12 | 19-13-27 [19:13:27] strc hashed : azsd.GfbNF6LS ----> 1272C0FAD08A6B931422870668437CD206F2A663B10EE1A06FAE1987A838233EE806CAAB3C29E4CFF2D33314847E40AF83FB65131F1D016AEED040B54A74614E [19:13:27] Query formatted ! [19:13:27] Query launched !
Thanks in advance, because I really don't see what's wrong.