Loading reports
#5

A little correction to Sawalha's code it has some errors -
pawn Код:
ACMD:reports(playerid, params[])
{
    if (pInfo[playerid][Adminlevel] < 1) return 0;
    new File:filex = fopen("Core/Logs/Report.txt", io_read) // Opens the reports file
    new buf[80]; // the string variable which we are gonna return the loaded string in.
    new str[500]; // we are gonna use this later..
    bool firstline = true;
    if(filex) // if the file exists
    {
          print("Reports file loaded successfully."); // for debugging.
          while(fread(filex, buf)) // a "while" loop for reading ALL the file and store it in the "buf"
          {   if(firstline)strcat(str,buf);//if it is first line then we will not add new line character( '\n' )
               else { strcat(str, "\n"); strcat(str, buf); }
               firstline = false;
         }
ShowPlayerDialog(playerid, reports, DIALOG_STYLE_LIST, "Reports", str, "Select", "Close"); // Swahala putted it inside while it should be outside
    }
    return 1;
}
Reply


Messages In This Thread
Loading reports - by LeXuZ - 06.12.2014, 23:26
Re: Loading reports - by Kaperstone - 06.12.2014, 23:33
Re: Loading reports - by LeXuZ - 07.12.2014, 14:11
Re: Loading reports - by Sawalha - 07.12.2014, 14:28
Re: Loading reports - by BroZeus - 07.12.2014, 14:40
Re: Loading reports - by LeXuZ - 07.12.2014, 16:06
Re: Loading reports - by Sawalha - 07.12.2014, 16:08
Re: Loading reports - by LeXuZ - 07.12.2014, 16:19
Re: Loading reports - by Sawalha - 07.12.2014, 16:38
Re: Loading reports - by LeXuZ - 07.12.2014, 16:40

Forum Jump:


Users browsing this thread: 1 Guest(s)