SA-MP Forums Archive
Code Bug help? - 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: Code Bug help? (/showthread.php?tid=599645)



Code Bug help? - SumX - 28.01.2016

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);
    } 



Re: Code Bug help? - Lucky13 - 28.01.2016

Maybe just use this?

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



Re: Code Bug help? - Deny1 - 28.01.2016

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);
}


Re: Code Bug help? - SumX - 28.01.2016

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


Re: Code Bug help? - Deny1 - 28.01.2016

Quote:

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

try.


Re: Code Bug help? - Lucky13 - 28.01.2016

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


Re: Code Bug help? - Deny1 - 28.01.2016

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


Re: Code Bug help? - Sithis - 28.01.2016

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

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


Re: Code Bug help? - Lucky13 - 28.01.2016

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