Callback not called by mysql_tquery
#1

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

PHP код:

// under OnDialogResponse
case DIALOG_REGISTER:
        {
            if(!
response)
            {
                
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_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(playeridDIALOG_REGISTERDIALOG_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(8salt);
            
printf("Random salt created : %s"salt);
            
strcat(strcinputtext);
            
printf("Inputted password inserted into strc : %s"inputtext);
            
strcat(strc".");
            
printf("Dot inserted into strc, strc = %s"strc);
            
strcat(strcsalt);
            
printf("Salt inserted into strc, strc = %s"strc);
            
GetPlayerIP(playeridipsizeof(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], 129strc);
            
printf("strc hashed : %s ----> %s"strcPlayerInfo[playerid][pPass]);
            
mysql_format(MySQLquerysizeof(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], saltdate[0], date[1], date[2], date[3], date[4], date[5], ip);
            
printf("Query formatted !");
            
mysql_tquery(MySQLquery"OnPlayerRegister""ii"playerid1);
            
printf("Query launched !");
            return 
1;
        }
// At the bottom of my script
public OnPlayerRegister(playeridstep)
{
    
printf("Called callback OnPlayerRegister");
    if(
step == 1)
    {
        
printf("Entering step 1");
        if(
cache_affected_rows() > 0printf("Showing dialog"), ShowPlayerDialog(playeridDIALOG_INPUTMAILDIALOG_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() > 0printf("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(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Connexion"dialog_display"Ok""Retour");
    }
    return 
1;

And here's my server_log :

Код:
[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 !
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.
Reply
#2

Anyone ?
Reply
#3

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
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

PHP код:

// under OnDialogResponse
case DIALOG_REGISTER:
        {
            if(!
response)
            {
                
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_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(playeridDIALOG_REGISTERDIALOG_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(8salt);
            
printf("Random salt created : %s"salt);
            
strcat(strcinputtext);
            
printf("Inputted password inserted into strc : %s"inputtext);
            
strcat(strc".");
            
printf("Dot inserted into strc, strc = %s"strc);
            
strcat(strcsalt);
            
printf("Salt inserted into strc, strc = %s"strc);
            
GetPlayerIP(playeridipsizeof(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], 129strc);
            
printf("strc hashed : %s ----> %s"strcPlayerInfo[playerid][pPass]);
            
mysql_format(MySQLquerysizeof(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], saltdate[0], date[1], date[2], date[3], date[4], date[5], ip);
            
printf("Query formatted !");
            
mysql_tquery(MySQLquery"OnPlayerRegister""ii"playerid1);
            
printf("Query launched !");
            return 
1;
        }
// At the bottom of my script
public OnPlayerRegister(playeridstep)
{
    
printf("Called callback OnPlayerRegister");
    if(
step == 1)
    {
        
printf("Entering step 1");
        if(
cache_affected_rows() > 0printf("Showing dialog"), ShowPlayerDialog(playeridDIALOG_INPUTMAILDIALOG_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() > 0printf("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(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Connexion"dialog_display"Ok""Retour");
    }
    return 
1;

And here's my server_log :

Код:
[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 !
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.
wht version of mysql u use
Reply
#4

Sorry of the late answer - wasn't home.

I use BlueG's R38.
Reply
#5

is there anything like mysql_tquerry i searched for it but cant find it
Reply
#6

It's a "special feature" of BlueG's plugin.
By "special feature" I mean "feature which isn't present on any other MySQL plugin for samp".
Reply
#7

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
It's a "special feature" of BlueG's plugin.
By "special feature" I mean "feature which isn't present on any other MySQL plugin for samp".
Use R7 Or R5 bec they r the only ones i used for it wand worked very good
and if you tried and it got solved by my answer dont forget to Rep+ Me bro and im free im staying here till it gets fixed
Reply
#8

I actually can't switch on a previous release for two major reasons :

The first one is that I made a whole mode using R38 and i don't want to edit all my queries using R5-7 syntax.
The second one is that if there are most recent releases, there is/are a/some reasons : speed, improvements, bug fixing...
Reply
#9

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
I actually can't switch on a previous release for two major reasons :

The first one is that I made a whole mode using R38 and i don't want to edit all my queries using R5-7 syntax.
The second one is that if there are most recent releases, there is/are a/some reasons : speed, improvements, bug fixing...
yep but also your problem xD you will have to give up ur whole script or ur mysql_tquery function script sorry to say that and maybe another person may have a solution but in the meanwhile this is all you got :/
Reply
#10

I haven't read the entire problem, but the first thing I saw was that the syntax for the insert query was wrong. It's supposed to be like -

pawn Код:
INSERT INTO `table`( fieldOne, fieldTwo ) VALUES( 22, 'test' )
Look into your mysql debug file too.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)