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]",F, S, T))
{
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? -
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.