tag mismatch - 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: tag mismatch (
/showthread.php?tid=645269)
tag mismatch -
CrazyPerry - 24.11.2017
How to Fix This?
Код:
if (! IsValidEmail(inputtext) == PlayerInfo[playerid][pEmail] && strcmp(email, inputtext))
{
SendClientMessage(playerid, COLOR_RED, "You have entered an unmatching email address.");
return 1;
}
i get this error!
Код:
warning 213: tag mismatch
Re: Help!!! -
Kane - 24.11.2017
Show your code for IsValidEmail. Assuming it returns true or false,
PHP код:
if (! IsValidEmail(inputtext) == PlayerInfo[playerid][pEmail]
Does not make sense.
Re: Help!!! -
CrazyPerry - 24.11.2017
Код:
#define IsValidEmail(%1) \
regex_match(%1, "[a-zA-Z0-9_\\.]+@([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,4}")
THIS
Re: Help!!! -
Kane - 24.11.2017
You can't do:
PHP код:
if (! IsValidEmail(inputtext) == PlayerInfo[playerid][pEmail]
Just check if the input matches with the variable. But if you also want to check if it's a valid e-mail:
PHP код:
stock IsValidEmailEx(const string[])
{
static
RegEx:rEmail
;
if ( !rEmail )
{
rEmail = regex_build("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");
}
return regex_match_exid(string, rEmail);
}
main()
{
printf("ValidEmail: %s", IsValidEmailEx("test@test.test") ? ("true") : ("false"));
printf("Non ValidEmail: %s", !IsValidEmailEx("t[e]st@test.test") ? ("true") : ("false"));
}
Source:
https://sampforum.blast.hk/showthread.php?tid=247893
You code would end up looking like:
PHP код:
if(!IsValidEmailEx(inputtext) || strcmp(email, inputtext, true))
{
return 1;
}
You used
&& but that means it needs to be an invalid e-mail and not a match. Using
||, it will work if it's either an invalid e-mail or if there isn't a match.
Re: Help!!! -
CrazyPerry - 24.11.2017
I see, but a code im doing is to match the email address he gave when he registered and match it when he forgot his password.
Re: tag mismatch -
thefirestate - 24.11.2017
You can't compare strings using "==", here you have to use "strcmp" function. Unless the pEmail is not actually his email stored in a string in which case I could be wrong as to what exactly is the problem.