17.05.2012, 13:24
I have /ban when someone ban with /ban it save their ban ip in bans.ini
now i have create /unbanip and in order to avoid the ban checking in unban user
i have to delete the lines in Bans.ini
Perfect timing i found fdeleteline somewhere in SAMP Forums.
The problem is i don't know how to use for my /unbanip
Can someone tell me how to do it?
now i have create /unbanip and in order to avoid the ban checking in unban user
i have to delete the lines in Bans.ini
Perfect timing i found fdeleteline somewhere in SAMP Forums.
The problem is i don't know how to use for my /unbanip
Can someone tell me how to do it?
pawn Код:
CMD:unbanip(playerid,params[])
{
new str[128], ip[50];
if(pData[playerid][Login] == 0) return SendClientMessage(playerid, COLOR_RED, "*** Please login first! ***");
if(pData[playerid][Admin] < 4 || IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "*** You are not Forum Desginer/Maker ***");
if(sscanf(params, "s[50]", ip)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unbanip [ip]");
format(str, sizeof(str), "unbanip %s", ip);
SendRconCommand(str);
return 1;
}
fdeleteline(filename[], line)
{
new count, string[256], File:file, File:temp;
file = fopen(filename, io_read);
temp = fopen("Bans.ini", io_write);
while (fread(file, string))
if (++count != line)
fwrite(temp, string);
fclose(file);
fclose(temp);
file = fopen(filename, io_write);
temp = fopen("Bans.ini", io_read);
while (fread(temp, string))
fwrite(file, string);
fclose(file);
fclose(temp);
fremove("Bans.ini");
}