SA-MP Forums Archive
Ban system help? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Ban system help? (/showthread.php?tid=403367)



Ban system help? - MattSlater - 30.12.2012

pawn Код:
stock fPermanentUnban(playerid, name[], reason[])
{
    new szBan[64];
    new File:pBans = fopen("Bans/pBans.cfg", io_read);
    while(fread(pBans, szBan)) {
        if(strcmp(szBan, name, true) == 0) {
            printf("Permanent unban: %s has been unbanned successfully.", name);
            format(szBan, sizeof(szBan), "[aCmd]: %s has been unbanned by %s, reason: %s.", GetPlayerNameEx(playerid), name, reason);
            adminSendMessage(COLOR_LIGHTRED, szBan);
            fwrite(pBans, "");
        }
        else {
            printf("Permanent unban: %s could not be found in the ban system.", name);
            SendClientMessage(playerid, COLOR_LIGHTRED, "Error, that name was not found in the ban file.");
        }
    }
    fclose(pBans);
}
Okay, I have made this so far, it find's the name etc - But how can I make it remove that line with the name?
All ban's go into the same file, so it's like this;
"My name" - new line "another name"
So, is there a way to do this? ;3