Dialog scripting -
Skank - 20.09.2011
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
Re: Dialog scripting -
Mean - 20.09.2011
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".
Re: Dialog scripting -
Skank - 20.09.2011
It doesn't save ...
Re: Dialog scripting -
Skank - 20.09.2011
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
Re: Dialog scripting -
aRoach - 20.09.2011
Well, the
inputtext ![Wink](images/smilies/wink.png)
:
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", "" );
  }
}
Re: Dialog scripting -
Skank - 20.09.2011
thanks, working now^^
Re: Dialog scripting -
aRoach - 20.09.2011
No problem, dude...
For this are we here, no?