This code do not compile to me. Help please! -
JavoDiaz - 26.12.2012
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.
Re: This code do not compile to me. Help please! -
[HiC]TheKiller - 26.12.2012
What are the errors that you get in the first code? The second code won't really improve anything.
Re: This code do not compile to me. Help please! -
JavoDiaz - 26.12.2012
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
Re: This code do not compile to me. Help please! -
JavoDiaz - 26.12.2012
The error is in the
pawn Код:
else ShowPlayerDialog(playerid, MAIL, DIALOG_STYLE_INPUT, ""yellow"Register", ...
because if I desactivate it, the gamemode compiles well.
Re: This code do not compile to me. Help please! -
JavoDiaz - 26.12.2012
Sorry for triple post but I need help because I cant continue scripting my gamemode :/
Re: This code do not compile to me. Help please! -
JaKe Elite - 26.12.2012
add return on else
not just else ShowPlayerDialog.
like this
pawn Код:
else return ShowPlayerDialog
this one is correct (^^)
Re: This code do not compile to me. Help please! -
JavoDiaz - 26.12.2012
No, the gamemode don't compile with the else return :/
Re: This code do not compile to me. Help please! -
JavoDiaz - 26.12.2012
The problem is in the
else.
When I desactivate the else the gamemode compile well. But I don't know why.
Re: This code do not compile to me. Help please! -
Joe Staff - 26.12.2012
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;
}
Re: This code do not compile to me. Help please! -
JavoDiaz - 26.12.2012
No, because the callback don't end in that dialog, check your code you are opening four '{' and closing five '}'