[HELP] Confused with making a report system
#2

take this as example

Put this somewhere in your script
PHP Code:
fdeleteline(filename[], line)
{
  new 
countstring[256], File:fileFile:temp;
  
filefopen(filenameio_read);
  
temp fopen("tmpfile.tmp"io_write);
  while (
fread(filestring))
    if (++
count != line)
      
fwrite(tempstring);
  
fclose(file);
  
fclose(temp);
  
filefopen(filenameio_write);
  
temp fopen("tmpfile.tmp"io_read);
  while (
fread(tempstring))
    
fwrite(filestring);
  
fclose(file);
  
fclose(temp);
  
fremove("tmpfile.tmp");

Then for read reports
PHP Code:
CMD:reports(playeridparams[])
{
    if (!
IsPlayerAdmin(playerid)) return 0;
    new 
strings[128], Filefile fopen("Asystem/Reports.ini"io_read), idxx=1;//You can change your folder destination
    
SendClientMessage(playeridCOLOR_ORANGE"[Reports]:");
    while(
fread(filestrings))
    {
        
format(stringssizeof(strings), "%d) %s"idxxstrings);
        
SendClientMessage(playeridCOLOR_ORANGEstrings);
        
idxx ++;
    }
    
fclose(file);
    return 
1;

Then Delete a report
PHP Code:
CMD:deletereport(playeridparams[])
{
    new 
line;
    new 
ppname[MAX_PLAYER_NAME];
    if (!
IsPlayerAdmin(playerid)) return 0;
    if(
sscanf(params"d"line)) return SendClientMessage2(playeridCOLOR_WHITE"Usage: /deletereport [reportid]");
    
SendClientMessage(playeridCOLOR_YELLOW"Report deleted.");
    if(
line 1) return SendClientMessage(playeridCOLOR_RED"Invalid report id.");
    
fdeleteline("Asystem/Reports.ini"line);//You can change your folder destination
    
return 1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)