SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/11/2017, 09:47 AM   #1
CrazyPerry
Big Clucker
 
CrazyPerry's Avatar
 
Join Date: Nov 2015
Posts: 50
Reputation: 0
Default tag mismatch

How to Fix This?

Code:
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!
Code:
warning 213: tag mismatch
CrazyPerry is offline   Reply With Quote
Old 24/11/2017, 09:58 AM   #2
Arthur Kane
Gangsta
 
Join Date: Sep 2012
Posts: 772
Reputation: 115
Default Re: Help!!!

Show your code for IsValidEmail. Assuming it returns true or false,

PHP Code:
if (! IsValidEmail(inputtext) == PlayerInfo[playerid][pEmail
Does not make sense.
__________________
LS:RP Development Team
Arthur Kane is offline   Reply With Quote
Old 24/11/2017, 10:10 AM   #3
CrazyPerry
Big Clucker
 
CrazyPerry's Avatar
 
Join Date: Nov 2015
Posts: 50
Reputation: 0
Default Re: Help!!!

Code:
#define IsValidEmail(%1) \
	regex_match(%1, "[a-zA-Z0-9_\\.][email protected]([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,4}")
THIS
CrazyPerry is offline   Reply With Quote
Old 24/11/2017, 10:20 AM   #4
Arthur Kane
Gangsta
 
Join Date: Sep 2012
Posts: 772
Reputation: 115
Default Re: Help!!!

You can't do:
PHP Code:
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 Code:
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(stringrEmail);
}

main()
{        
    
printf("ValidEmail: %s"IsValidEmailEx("[email protected]") ? ("true") : ("false"));
    
printf("Non ValidEmail: %s", !IsValidEmailEx("t[e][email protected]") ? ("true") : ("false"));

Source: http://forum.sa-mp.com/showthread.php?t=247893

You code would end up looking like:

PHP Code:
if(!IsValidEmailEx(inputtext) || strcmp(emailinputtexttrue))
{
     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.
__________________
LS:RP Development Team
Arthur Kane is offline   Reply With Quote
Old 24/11/2017, 11:16 AM   #5
CrazyPerry
Big Clucker
 
CrazyPerry's Avatar
 
Join Date: Nov 2015
Posts: 50
Reputation: 0
Default Re: Help!!!

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.
CrazyPerry is offline   Reply With Quote
Old 24/11/2017, 01:04 PM   #6
thefirestate
Big Clucker
 
Join Date: Sep 2014
Location: Bulgaria
Posts: 172
Reputation: 10
Default Re: tag mismatch

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.
thefirestate is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tag mismatch XxXBr0nXxX Scripting Help 0 27/03/2016 02:13 AM
Tag mismatch Dzines4SAMP Scripting Help 7 30/04/2013 08:36 AM
[HELP] tag mismatch agreathon Help Archive 4 25/07/2011 01:14 AM
[Help] Argument type mismatch and tag mismatch Spiffyk Help Archive 2 27/12/2010 12:04 PM


All times are GMT. The time now is 06:09 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.