SA-MP Forums Archive
unban command ingame doesnt work! - 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: unban command ingame doesnt work! (/showthread.php?tid=403953)



unban command ingame doesnt work! - mickos - 01.01.2013

Hey, I have a /unban command, it work good, it says, that I succesfully unbanned the players ip, but when te player try to join the server, he got a message that he is still banned..

Whats wrong?

pawn Код:
CMD:unban(playerid, params[])
{
    new str[128], ip[16];
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "You are not logged in, please login first.");
    if(PlayerAcc[playerid][Admin] == 0) return SendClientMessage(playerid, -1,""orange"Sorry, only admins level 5+ can do that command.");
    if(PlayerAcc[playerid][Admin] >= 5)
    {
        if(sscanf(params, "s[16]", ip)) return SendClientMessage(playerid, COLOR_ORANGE, "You must be type: /unban <ip>");
        if(!stringContainsIP(ip)) return SendClientMessage(playerid, COLOR_RED, "You didn't put a ip!");
        SendClientMessageToAll(COLOR_YELLOW, str);
        format(str, sizeof(str), "You have been unbanned succesfully the ip '%s'", ip);
        SendClientMessage(playerid, COLOR_YELLOW, str);
        strdel(ip, strlen(ip)-2, strlen(ip));
        format(ip, sizeof(ip), "%s", ip);
        format(str, sizeof(str), "unbanip %s", ip);
        SendRconCommand(str);
        SendRconCommand("reloadbans");
    }
    else return ErrorMessages(playerid, 7);
    return 1;
}



Re: unban command ingame doesnt work! - Diorturato - 01.01.2013

Debug it.

Easy way:

pawn Код:
sscanf(params, "s[16]", ip);
format(str, sizeof(str), "unbanip %s", ip);
SendRconCommand(str);
SendRconCommand("reloadbans");



Re: unban command ingame doesnt work! - mickos - 01.01.2013

Ahh I must be delete this one:
Quote:

format(ip, sizeof(ip), "%s", ip);

and I must be replace it with:
Quote:

sscanf(params, "s[16]", ip);

?


Re: unban command ingame doesnt work! - Diorturato - 01.01.2013

No no no.

pawn Код:
strdel(ip, strlen(ip)-2, strlen(ip));
format(ip, sizeof(ip), "%s", ip);
What is it? Delete it.