SA-MP Forums Archive
error DialogId - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error DialogId (/showthread.php?tid=309710)



error DialogId - jaskiller - 08.01.2012

hi I receive this error why?? :

Код:
error 021: symbol already defined: "query"
my code

PHP код:
        case DIALOG_REGISTER_PASS :
        {
            if (
strlen(inputtext) < || strlen(inputtext) > 24 || !response)
            {
                
SendClientMessage(playeridCOLOR_ERROR"Votre mot de pass doit contenir entre 4 et 24 caractйres");
                return 
Kick(playerid);
            }
            new 
query[128],escaped[2][24];
            
mysql_real_escape_string(PlayerName(playerid), escaped[0]);
            
mysql_real_escape_string(inputtextescaped[1]);
            
format(querysizeof(query), "INSERT INTO PlayerData(Name, Password) VALUES('%s', '%s')"escaped[0], escaped[1]);
            
mysql_query(query);
            return 
ShowPlayerDialog(playeridDIALOG_REGISTER_SEXEDIALOG_STYLE_LIST"Votre Sexe""Homme\nFemme""Accepter","");
        }
        
        case 
DIALOG_REGISTER_SEXE :
        {
            new 
query[128];
            if(
listitem == 0)
            {
                
format(querysizeof(query), "UPDATE PlayerData SET Sexe = 'Homme' WHERE Name = '%s'",PlayerName(playerid));
                
mysql_query(query);
            }
            else
            {
                
format(querysizeof(query), "UPDATE PlayerData SET Sexe = 'Femme' WHERE Name = '%s'",PlayerName(playerid));
                
mysql_query(query);
            }
            return 
ShowPlayerDialog(playeridDIALOG_REGISTER_SEXEDIALOG_STYLE_LIST"Votre Sexe""Homme\nFemme""Accepter","");
        } 



Re: error DialogId - Psymetrix - 08.01.2012

You have new query[128] somewhere outside your switch statement. I can't tell you exactly where as you would need to show more of your script.


Re: error DialogId - Steven82 - 08.01.2012

Well if thats the case change it to this.

pawn Код:
new query2[128];
And change all the "query" in your switch statement to "query2". But if you don't want to do that, your going to have to do what Psymetrix said. But it would be more logical to go Psymetrix's route.


Re : error DialogId - jaskiller - 08.01.2012

but when I put only this code no error :

PHP код:
    case DIALOG_REGISTER_PASS :
        {
            if (
strlen(inputtext) < || strlen(inputtext) > 24 || !response)
            {
                
SendClientMessage(playeridCOLOR_ERROR"Votre mot de pass doit contenir entre 4 et 24 caractйres");
                return 
Kick(playerid);
            }
            new 
query[128],escaped[2][24];
            
mysql_real_escape_string(PlayerName(playerid), escaped[0]);
            
mysql_real_escape_string(inputtextescaped[1]);
            
format(querysizeof(query), "INSERT INTO PlayerData(Name, Password) VALUES('%s', '%s')"escaped[0], escaped[1]);
            
mysql_query(query);
        } 



Re : error DialogId - jaskiller - 08.01.2012

when i test the code step by step :

when I add : escaped[2][25] : I receive the error why??


Re: error DialogId - Jefff - 08.01.2012

This is a bug I had exactly the same error a few days ago, add only here
if(response) {
new query[128];
switch(listitem)
{


Re: Re : error DialogId - Steven82 - 08.01.2012

Quote:
Originally Posted by jaskiller
Посмотреть сообщение
when i test the code step by step :

when I add : escaped[2][25] : I receive the error why??
Well what is the error? We can't magically know the error.


Re : error DialogId - jaskiller - 09.01.2012

error 021: symbol already defined: "query";

read the other message of post.