Code Bug help?
#1

Hello, what is wrong with this code? Its an INPUT dialog where I must insert an email like this type: something@something.something.

No matter what I type, I get the "Invalid E-Mail!" message.
Thank you!

PHP код:
if(dialogid == DIALOG_EMAIL)
    {
        if(
response)
        {
            new 
F[40], S[20], T[4];
            if(
sscanf(inputtext"s[40]p<@>s[20]P<.>s[4]",FST))
            {
                
SelectTextDraw(playeridBLUES);
                
ShowPlayerDialog(playeridDIALOG_EMAILDIALOG_STYLE_INPUT"You:RPG Registration System:""Please insert your E-Mail.""OK""Cancel");
                  
SCM(playeridCOLOR_DGREY"Invalid E-Mail!");
            }
            else
            {
                if(
strlen(inputtext) > 64)
                {
                    
SelectTextDraw(playeridBLUES);
                    
ShowPlayerDialog(playeridDIALOG_EMAILDIALOG_STYLE_INPUT"You:RPG Registration System:""Please insert your E-Mail.""OK""Cancel");
                    
SCM(playeridCOLOR_DGREY"Invalid E-Mail!");
                }
                else
                {
                    
SelectTextDraw(playeridBLUES);
                    
format(EMailRemember[playerid], 64inputtext);
                    
PlayerTextDrawSetString(playeridTextdrawEMail[playerid], EMailRemember[playerid]);
                    
PlayerTextDrawLetterSize(playeridTextdrawEMail[playerid], 0.2251992.690132);
                    
DatePersonale[playerid]++;
                }
            }
        }
        else 
SelectTextDraw(playeridBLUES);
    } 
Reply
#2

Maybe just use this?

Код:
if(strfind(inputtext,"@",true) != -1) // Checks if there is a @ in the inputtext
Reply
#3

if(dialogid == DIALOG_EMAIL)
{
if(response)
{
new F[40], S[20], T[4];
if(strfind(inputtext,"@",true) != -1)
{
SelectTextDraw(playerid, BLUES);
ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "You:RPG Registration System:", "Please insert your E-Mail.", "OK", "Cancel");
SCM(playerid, COLOR_DGREY, "Invalid E-Mail!");
}
else
{
if(strlen(inputtext) > 64)
{
SelectTextDraw(playerid, BLUES);
ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "You:RPG Registration System:", "Please insert your E-Mail.", "OK", "Cancel");
SCM(playerid, COLOR_DGREY, "Invalid E-Mail!");
}
else
{
SelectTextDraw(playerid, BLUES);
format(EMailRemember[playerid], 64, inputtext);
PlayerTextDrawSetString(playerid, TextdrawEMail[playerid], EMailRemember[playerid]);
PlayerTextDrawLetterSize(playerid, TextdrawEMail[playerid], 0.225199, 2.690132);
DatePersonale[playerid]++;
}
}
}
else SelectTextDraw(playerid, BLUES);
}
Reply
#4

Yes but I want the players to type the email like this asd@asd.asd
If I do like you, they can type it like this and still it will be correct: @.asadasdada
Am I wrong? @Lucky 13

@Deny1 ok right now
Reply
#5

Quote:

if(strfind(inputtext,"s[40]p<@>s[20]P<.>s[4]",true) != -1)

try.
Reply
#6

Quote:
Originally Posted by Deny1
Посмотреть сообщение
try.
Would you please stop copying what I wrote and posting bullshit codes?
Reply
#7

Stay cool hahaha...i'm just trying to help and improve with bullshit my experience if i'm wrong he can say just you wrong
Reply
#8

Use the regex plugin and just test for a valid e-mail that way.

https://sampforum.blast.hk/showthread.php?tid=247893
Reply
#9

Quote:
Originally Posted by Deny1
Посмотреть сообщение
improve with bullshit my experience
Seems legit. Wish you the bests.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)