fremove bug
#7

Quote:
Originally Posted by Jf
View Post
PHP Code:
CMD:clearbans(playerid)
{
    if(!
IsAuth(playerid6)) return NoAuth(playerid);
    
    
// Create the file on OnGameModeInit() using io_append instead of io_write. By doing this you don't need to check if the file exist before this command executes.
    
    
new
        
File:handle fopen("bans.cfg"io_write), // io_write deletes the entire data in the file. No need to use fremove.
        
string[128];
        
    if(
handle// Valid handle
    
{
        
fclose(handle); // Close the file. Data has been deleted.
        
        
format(stringsizeof(string), "AdmCmd: %s %s has cleared the ban list, therefore everyone has been unbanned."RPARN(playerid), RPN(playerid));
        
Log("unban.log"string);
        
SendAMessage(1string);
    }
    else 
// We must check this, just in case.
    
{
        
format(stringsizeof(string), "Admin %s %s tried to erase the data of ban.cfg. There's been an error while deleting the data."RPARN(playerid), RPN(playerid));
        
Log("unban.log"string);
        
        print(string);
        
SendClientMessage(playerid, -1">> There has been an error while deleting the ban file. Report the server's owner.");
    }
    return 
1;

Modified it a bit but works, thanks
Reply


Messages In This Thread
fremove bug - by NeXoR - 20.06.2016, 04:02
Re: fremove bug - by Gammix - 20.06.2016, 04:21
Re: fremove bug - by Slawiii - 20.06.2016, 04:21
Re: fremove bug - by Dayrion - 20.06.2016, 04:25
Re: fremove bug - by NeXoR - 20.06.2016, 05:04
Re: fremove bug - by Jf - 20.06.2016, 05:24
Re: fremove bug - by NeXoR - 20.06.2016, 07:01

Forum Jump:


Users browsing this thread: 1 Guest(s)