String problem
#1

Can someone help me.
I'm trying to save the email at the registration of users.
My problem is that I got only the first character of the email on the file.

This is what I made.
I'm doing someting wrong with the string.

I got already the email on the user file .ini but I trying
to write it also in a another file that I named mailing.ini
The aim is to have all the emails users on a unique file.

Quote:

public SaveMailing(playerid)
{
new Texte[128];
Email[playerid] = PlayerInfo[playerid][pEmail];
format(Texte, sizeof(Texte), "%s\r\n", Email);
new File: file2 = fopen("LARP/mailing.ini", io_append);
fwrite(file2, Texte);
fclose(file2);
return 1;
}
Reply
#2

how is the user inputting the email
Reply
#3

when the user login for the first time, he got a dialog box who ask
him to put is email. It's at this step that I collect the email that i
write on his own .ini file.

I have add the fonction savemailing(playerid);
at the end of code to made the two operation at the same step.

Quote:

if(dialogid == 1249)
{
if(response == 1)
{
if(strlen(inputtext) > 1)
{
if(strfind(inputtext,"@",true) != -1)
{
new string3[64];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "LARP/Users/%s.ini", playername3);
strmid(PlayerInfo[playerid][pEmail], inputtext, 0, 32, 32);
dini_Set(string3, "Email",PlayerInfo[playerid][pEmail]);
SaveMailing(playerid);
ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,"Bienvenue, enregistrez-vous","Compte crйe avec succиs!\nTapez votre password pour vous connecter","Log-in","Quitter");
return 1;
}
else
{
ShowPlayerDialog(playerid, 1249,DIALOG_STYLE_INPUT, "Enregistrez votre email","Votre adresse n'est pas valide!\nTapez votre email","Ok","Annuler");
}
}
else
{
ShowPlayerDialog(playerid, 1249, DIALOG_STYLE_INPUT,"Enregistrez votre email","Vous n'avez pas enregistrй d'email!\nTapez votre email","Ok","Annuler");
}
}
else
{
ShowPlayerDialog(playerid, 1249, DIALOG_STYLE_INPUT,"Enregistrez votre email","Vous n'avez pas enregistrй d'email!\nTapez votre email","Ok","Annuler");
}
}
Reply
#4

Up

No one if any ideas?
May be with an another way?
Reply
#5

Take a look at the OnPlayerDialogResponse for the register dialog and go by that.. The password saves all the characters so try to mimic that a bit.

^^, that's just my suggestion.
Reply
#6

Quote:
pawn Код:
Email[playerid] = PlayerInfo[playerid][pEmail];
You can copy strings like that if the lenght is equal to each other; however, I used to have a problem with this way and it copied only only the first character as well as your problem.

I used
pawn Код:
stock strcpy(dest[], const source[], maxlength=sizeof dest)
{
    strcat((dest[0] = EOS, dest), source, maxlength);
}
and it fixed my problem.
Reply
#7

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
Take a look at the OnPlayerDialogResponse for the register dialog and go by that.. The password saves all the characters so try to mimic that a bit.

^^, that's just my suggestion.
Thanks. I got it. It worked.

Solution was easy.

Quote:

forward SaveMailing(playerid, Email[]);

Quote:

if(strfind(inputtext,"@",true) != -1)
{
new string3[64];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "LARP/Users/%s.ini", playername3);
strmid(PlayerInfo[playerid][pEmail], inputtext, 0, 32, 32);
dini_Set(string3, "Email",PlayerInfo[playerid][pEmail]);
SaveMailing(playerid, inputtext);
ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,"Bienvenue, enregistrez-vous","Compte crйe avec succиs!\nTapez votre password pour vous connecter","Log-in","Quitter");
return 1;
}

Quote:

public SaveMailing(playerid, Email[])
{
new Texte[128];
Email[playerid] = PlayerInfo[playerid][pEmail];
format(Texte, sizeof(Texte), "%s\r\n", Email);
new File: file2 = fopen("LARP/mailing.ini", io_append);
fwrite(file2, Texte);
fclose(file2);
return 1;
}

Quote:

Email[playerid] = PlayerInfo[playerid][pEmail];

I don't know if this line is really necessary now. Email[playerid] = PlayerInfo[playerid][pEmail];
Logically not.
But thank for your idea to watch the password line.

Edit: Like i mean, this line is not usefull. Email[playerid] = PlayerInfo[playerid][pEmail];
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)