Unban IP Not working
#1

Okay, I made a /unbanacc command which allows you to unban someone ofc. I used the same function as /unbanip and that works but here is doesn't. Whats it doing? = Opening the users file searching for the pIP = xx.xx.xx.xx and then Sends a rcon command to unban the ip. It's just not working. It sends me the message of "unbanip xx.xx.xx.xx" but doesn't unban through the samp.ban file.
pawn Код:
CMD:unbanacc(playerid, params[])
{

    if(isnull(params)) {
        return SendClientMessage(playerid, -1, "Usage: /unbanacc [PlayerFile]");
    }

    new filename[MAX_PLAYER_NAME+18];
    format(filename, sizeof(filename), "/ZMA/Users/%s.ini", params);

    if(!fexist(filename)) {
        return SendClientMessage(playerid, -1, "That account doesn't exist!");
    }

    new
        File:file = fopen(filename, io_read),
        string[128],
        Name[20],
        Value[128],
        cash;

    while(fread(file, string)) {
        if(!sscanf(string, "p<=>s[20]s[128]", Name, Value)) {
            if(!strcmp(Name, "pIP ")) {
                cash = strval(Value);
                format(string, sizeof(string), "unbanip%s", cash);
                SendClientMessage(playerid, -1, string);
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                break;
            }
        }
    }
    return true;
}
Reply
#2

"unbanip%s", cash);

There should be a space.
Reply
#3

No I've tried it like that. It loads the space from the user file (pIP = xx.xx.xx.xx)
Reply
#4

Have you tried unbanning someone on 1 command and then, unbanning the IP on another?
Reply
#5

not:
PHP код:
format(stringsizeof(string), "unbanip%s"cash); 
use:
PHP код:
format(stringsizeof(string), "unbanip %s"cash); 
Reply
#6

Apart from the weird naming that you use for your variables. Why do you all put an INTEGER in a STRING and then try to use it to unban an IP (which is not an INT value anyways)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)