PDA

View Full Version : VALUE = VALUE on dialog


Nin9r
24/08/2018, 12:49 PM
Hello!

I`m trying to make a system to validate an e-mail.

I did /setmail, when someone will enter an e-mail adress will receive on it a validation key.

After it, he must insert validation key from e-mail but i do not know how to check if the inputtext value is the same with validation key.

I did it:

case 589:
{

if(response && strlen(inputtext)<10)
{
new da = strlen(inputtext);
if(PlayerData[playerid][pMailKey] == da)
{
new Str[256],pname2[25];
GetPlayerName(playerid,pname2,25);
format(string128, sizeof(string128), "You e-mail adress was validated: %s", PlayerData[playerid][pEmail]);
SCM(playerid, COLOR_GRAD4, string128);
PlayerData[playerid][pMailValid] = 1;
format(Str,256,"UPDATE `playeraccounts` SET `MailKey`='0' WHERE `playerID`='%d'",PlayerData[playerid][pInternalID]);
mysql_tquery(handle,Str);
format(Str,256,"UPDATE `playeraccounts` SET `playerMailValid`='%d' WHERE `playerID`='%d'",PlayerData[playerid][pMailValid],PlayerData[playerid][pInternalID]);
mysql_tquery(handle,Str);
}
return 1;
}
}

I use new da = strlen(inputtext);
if(PlayerData[playerid][pMailKey] == da) to check if the value is the same but even if I insert the right value it is doesn't work.

P.S.: In the last dialog when the e-mail is sent PlayerData[playerid][pMailKey] gets that value.

How can I do this?

DarkSkull
24/08/2018, 01:44 PM
Use strcmp():
http://wiki.sa-mp.com/wiki/Strcmp

Shinja
24/08/2018, 02:08 PM
PlayerData[playerid][pMailKey] is a string or number?

Nin9r
24/08/2018, 02:14 PM
It is a number! I forgot to say it.

Nin9r
24/08/2018, 02:20 PM
I solved this problem.

I changed new da = strlen(inputtext); into new da = strval(inputtext); and i used if(Player....[pMailKey] == da) . Thanks a lot !