Unbanip crashes the server
#1

Hey guys, when I execute the command, it simply closes my server

PHP код:
CMD:unbanip(playeridparam[])
{
    if(!
IsAuth(playerid3)) return NoAuth(playerid);
    if(
sscanf(param"s[16]"param)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /unbanip [IP]");
    if(!
IsIP(param)) return SendClientMessage(playeridCOLOR_WHITE"Invalid IP Address.");
    new 
File:ban fopen("samp.ban"io_read);
    new 
idx 1string[128];
    while(
fread(banstring))
    {
        if(
strfind(stringparamtrue) != -1)
        {
            
fdeleteline("samp.ban"idx);
            
format(stringsizeof(string), "AdmWarn: %s %s has unbanned IP Address %s"RPARN(playerid), RPN(playerid), param);
            
SendAMessage(1string);
            
format(stringsizeof(string), "AdmWarn: %s (%s) has unbanned IP %s"RPN(playerid), RPIP(playerid), param);
            
Log("logs/unban.log"string);
            
fclose(ban);
            print(
"Success.");
            return 
1;
        }
        
printf("IDX: %d"idx);
        
idx++;
    }
    
fclose(ban);
    print(
"Fail.");
    
SendClientMessage(playeridCOLOR_WHITE"IP Address is not banned.");
    return 
1;

fdeleteline (found somewhere on the forums)
PHP код:
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");

Anyone ?
Reply


Messages In This Thread
Unbanip crashes the server - by NeXoR - 18.06.2016, 03:53
Re: Unbanip crashes the server - by DTV - 18.06.2016, 04:18
Re: Unbanip crashes the server - by NeXoR - 18.06.2016, 04:43
Re: Unbanip crashes the server - by Konstantinos - 18.06.2016, 11:55
Re: Unbanip crashes the server - by Vince - 18.06.2016, 12:19

Forum Jump:


Users browsing this thread: 1 Guest(s)