Dialog scripting
#1

What i want is - After a player writes something in the INPUT dialog, it will save in a .log file at scriptfiles. But only the text, i don't want to save the players name etc. There the dialog i got

Код:
if(dialogid == 12347)
		{
			if(response)
			{
 				new regstring[128];
				new regname[64];
				GetPlayerName(playerid,regname,sizeof(regname));
				format(regstring,sizeof(regstring),"%s. Du hast dich erfolgreich registriert",regname);
				ShowPlayerDialog(playerid,12349,DIALOG_STYLE_INPUT,"{0080C0}Highness RolePlay","How did you find us?","Next","");
			}
		}
As said, i want to save the text every player writes there, but it should always make new line if possible
Reply
#2

First, add this anywhere in the script:
pawn Код:
// "stolen" from LuxAdmin:
stock SaveIn(filename[],text[]) {
    new File:Lfile;
    new filepath[256];
    new string[256];
    new year,month,day;
    new hour,minute,second;
   
    getdate(year,month,day);
    gettime(hour,minute,second);
    format(filepath,sizeof(filepath),"Logs/%s.txt",filename);
    Lfile = fopen(filepath,io_append);
    format(string,sizeof(string),"[%02d/%02d/%02d | %02d:%02d:%02d] %s\r\n",day,month,year,hour,minute,second,text);
    fwrite(Lfile,string);
    fclose(Lfile);
    return 1;
}
And then:
pawn Код:
if(dialogid == 12347) {
    if(response) {
        new regstring[128];
        new regname[64];
        GetPlayerName(playerid,regname,sizeof(regname));
        format(regstring,sizeof(regstring),"%s. Du hast dich erfolgreich registriert",regname);
        SaveIn( "reglog.txt", regstring );
        ShowPlayerDialog(playerid,12349,DIALOG_STYLE_INPUT,"{0080C0}Highness RolePlay","How did you find us?","Next","");
    }
}
Should work. Saves in "scriptfiles\Logs\reglog.txt".
Reply
#3

It doesn't save ...
Reply
#4

Ups, it saves, but it saves the text "Du hast dich erfolgreich registriert"

I want to save the text which a player writes in the dialog
Reply
#5

Well, the inputtext :
pawn Код:
if( dialogid == 12347 )
{
    if( response )
    {
        SaveIn( "reglog.txt", inputtext );
        ShowPlayerDialog( playerid, 12349, DIALOG_STYLE_INPUT, "{0080C0}Highness RolePlay", "How did you find us?", "Next", "" );
    }
}
Reply
#6

thanks, working now^^
Reply
#7

No problem, dude...

For this are we here, no?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)