07.12.2014, 14:40
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;
}

