This code do not compile to me. Help please!
#1

This code do not compile to me:

pawn Код:
if(dialogid == MAIL)
    {
        if(response)
        {
            if(strlen(inputtext))
            {
                if(strfind(inputtext, "@", false) != -1 && strfind(inputtext, ".", false) != -1)
                {
                    new mysql_name[MAX_PLAYER_NAME];
                    mysql_real_escape_string(inputtext, PlayerData[playerid][pMail]);
                    mysql_real_escape_string(GetName(playerid), mysql_name);
                    format(string, 90, "UPDATE users SET Mail='%s' WHERE Name='%s'", PlayerData[playerid][pMail], mysql_name);
                    mysql_function_query(1, string, false, "OnPlayerPutMail", "i", playerid);
                }
                else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ""red"ERROR: You have to put a valid email address.\n\n"white"Now you have to put a valid email address to recover the password if you have forgot it and the server will send you a lot of information, news, updates, etc.\n\n"yellow"If you don't want receive emails from the server you can desactivate it by the player menu (/config)", "Accept", "");
    }
            else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ""red"ERROR: You have to put a valid email address.\n\n"white"Now you have to put a valid email address to recover the password if you have forgot it and the server will send you a lot of information, news, updates, etc.\n\n"yellow"If you don't want receive emails from the server you can desactivate it by the player menu (/config)", "Accept", "");
    }
    else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ""red"ERROR: You have to put a valid email address.\n\n"white"Now you have to put a valid email address to recover the password if you have forgot it and the server will send you a lot of information, news, updates, etc.\n\n"yellow"If you don't want receive emails from the server you can desactivate it by the player menu (/config)", "Accept", "");
    return 1;
}

I try solve it putting short line codes doing that:

pawn Код:
if(dialogid == MAIL)
{
    #define s ShowPlayerDialog
    #define p playerid
    #define d MAIL
    #define s DIALOG_STYLE_INPUT
    #define r "Register"
    #define t ""red"ERROR: You have to put a valid email address.\n\n"white"Now you have to put a valid email address to recover the password if you have forgot it and the server will send you a lot of information, news, updates, etc.\n\n"yellow"If you don't want receive emails from the server you can desactivate it by the player menu (/config)"
        if(response)
        {
            if(strlen(inputtext))
            {
                if(strfind(inputtext, "@", false) != INVALID && strfind(inputtext, ".", false) != INVALID)
                {
                    new mysql_name[MAX_PLAYER_NAME];
                    mysql_real_escape_string(GetName(playerid), mysql_name);
                    mysql_real_escape_string(inputtext, PlayerData[playerid][pMail]);
                    format(string, 90, "UPDATE users SET Mail='%s' WHERE Name='%s'", PlayerData[playerid][pMail], mysql_name);
                    mysql_function_query(1, string, false, "OnPlayerPutMail", "i", playerid);
                }
                else s(p, d, s, r, t, "Accept", "");
    }
    else s(p, d, s, r, t, "Accept", "");
        }
        else s(p, d, s, r, t, "Accept", "");
        #undef s
        #undef p
        #undef d
        #undef s
        #undef r
        #undef t
        return 1;
}

But nothing. Help me please, if I compile the code the compiler stop responding and I have to kill the pawncc.exe process to continue :/


Thanks.
Reply
#2

What are the errors that you get in the first code? The second code won't really improve anything.
Reply
#3

I don't have an error, the compiler stop responding and no compile, I have to kill the pawncc.exe process to continue, I think that happen because the line is so large, but that have to return me an error but no. :/


Sorry for my bad english
Reply
#4

The error is in the
pawn Код:
else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ...
because if I desactivate it, the gamemode compiles well.
Reply
#5

Sorry for triple post but I need help because I cant continue scripting my gamemode :/
Reply
#6

add return on else

not just else ShowPlayerDialog.
like this

pawn Код:
else return ShowPlayerDialog

this one is correct (^^)
Reply
#7

No, the gamemode don't compile with the else return :/
Reply
#8

The problem is in the else.

When I desactivate the else the gamemode compile well. But I don't know why.
Reply
#9

You're missing a final '}' near the end.

pawn Код:
if(dialogid == MAIL)
    {
        if(response)
        {
            if(strlen(inputtext))
            {
                if(strfind(inputtext, "@", false) != -1 && strfind(inputtext, ".", false) != -1)
                {
                    new mysql_name[MAX_PLAYER_NAME];
                    mysql_real_escape_string(inputtext, PlayerData[playerid][pMail]);
                    mysql_real_escape_string(GetName(playerid), mysql_name);
                    format(string, 90, "UPDATE users SET Mail='%s' WHERE Name='%s'", PlayerData[playerid][pMail], mysql_name);
                    mysql_function_query(1, string, false, "OnPlayerPutMail", "i", playerid);
                }
                else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ""red"ERROR: You have to put a valid email address.\n\n"white"Now you have to put a valid email address to recover the password if you have forgot it and the server will send you a lot of information, news, updates, etc.\n\n"yellow"If you don't want receive emails from the server you can desactivate it by the player menu (/config)", "Accept", "");
            }
            else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ""red"ERROR: You have to put a valid email address.\n\n"white"Now you have to put a valid email address to recover the password if you have forgot it and the server will send you a lot of information, news, updates, etc.\n\n"yellow"If you don't want receive emails from the server you can desactivate it by the player menu (/config)", "Accept", "");
        }
        else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ""red"ERROR: You have to put a valid email address.\n\n"white"Now you have to put a valid email address to recover the password if you have forgot it and the server will send you a lot of information, news, updates, etc.\n\n"yellow"If you don't want receive emails from the server you can desactivate it by the player menu (/config)", "Accept", "");
    } //HERE
    return 1;
}
Reply
#10

No, because the callback don't end in that dialog, check your code you are opening four '{' and closing five '}'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)