fdeleteline
#6

This is my banip command, check it for an example of fdeleteline usage.
pawn Код:
CMD:unbanip(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
    new string[128];
    if(sscanf(params, "s[16]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unbanip [ip]");
    if(CheckInvalidIP(params)) return SendClientMessage(playerid, COLOR_GREY, "Invalid IP Address.");
    new File:ban = fopen("ban.cfg", io_read);
    new idx = 1, done;
    while(fread(ban, string))
    {
        if(!strcmp(params, string, true, strlen(params)))
        {
            fdeleteline("ban.cfg", idx);
            format(string, sizeof(string), "AdmWarn: %s has unbanned IP %s", RPN(playerid), params);
            SendAdminMessage(COLOR_DARKRED, 1, string);
            done = 1;
        }
        idx++;
    }
    fclose(ban);
    if(!done) SendClientMessage(playerid, COLOR_GREY, "IP is not banned.");
    return 1;
}
Reply


Messages In This Thread
fdeleteline - by JaKe Elite - 17.05.2012, 13:24
Re: fdeleteline - by Vince - 17.05.2012, 13:28
Re: fdeleteline - by Ballu Miaa - 17.05.2012, 13:29
Re: fdeleteline - by JaKe Elite - 17.05.2012, 13:31
Re: fdeleteline - by JaKe Elite - 17.05.2012, 13:56
Re: fdeleteline - by iRage - 17.05.2012, 14:11

Forum Jump:


Users browsing this thread: 1 Guest(s)