Not loading IP when using unban
#1

Hello there is a command i have created which should unban-ip offline user, by getting IP from file. used many methods but the IP doesn't showup on the test prints..

pawn Код:
new uIP[16];
pawn Код:
forward LoadIP(name[],value[]);
public LoadIP(name[],value[])
{
    INI_String("IP", uIP, 16);
    return 1;
}
pawn Код:
CMD:unban(playerid, params[])
{
    new playerb[32], str[256];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "s[32]", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /uban [name]");
    //if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server.");
    format(str, sizeof(str), "UserDB/%s.ini", playerb);
    if(!dini_Exists(str)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    // Normal Unban
    new INI:File = INI_Open(str);
    INI_SetTag(File,"PlayerData");
    INI_WriteString(File, "BanReason", "None");
    INI_WriteString(File, "BannedBy", "None");
    INI_WriteInt(File, "Banned", 0);
    INI_Close(File);
    // Ban.cfg Unban
    INI_ParseFile(str, "LoadIP");
    new File:ban = fopen("ban.cfg", io_read);
    new idx = 1;
    while(fread(ban, uIP))
    {
        if(!strcmp(uIP, str, true, strlen(uIP)))
        {
            fdeleteline("ban.cfg", idx);
            //done = 1;
        }
        idx++;
    }
    fclose(ban);
    //
    // ban.samp Unban
    format(str, sizeof(str), "unbanip %s", uIP);
    SendRconCommand(str);
    printf(str);
    SendRconCommand("reloadbans");
    format(str, sizeof(str), "{F81414}AdmWarn: %s has {DAE368}unbanned{F81414} %s. [IP: %s]", RPN(playerid), playerb, uIP);
    SendClientMessageToAll(COLOR_YELLOW, str);
    return 1;
}
This command doesn't print any IP.. can anyone tell me why?
Reply
#2

UP, please anyone?
Reply
#3

What does ban.cfg do? What's the point of it?

Also you are using Dini for checking if file exist and Yini for saving the data?
Reply
#4

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
What does ban.cfg do? What's the point of it?

Also you are using Dini for checking if file exist and Yini for saving the data?
ban.cfg saves the IP of players to custom ban config. its my ip bans. i use this instead of using samp bans. does it matter? the command doesn't print IP.. doesn't anyone has a clue?

Yes im using dini it works like a charm when needs to find and check if exists.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)