PDA

View Full Version : Help me please with banip and unban command


ownboy
20/11/2012, 04:50 AM
CMD:banip(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new command[128], string[128], ip;
if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /ipban [Banned IP]");
{
format(string, sizeof(string), "aCMD: %s banned someone", Name(playerid));
SendClientMessageToAll(C_RED, string);
format(command,sizeof(command),"banip %s", ip);
SendRconCommand(command);
printf("UNBAN Executed by %i",playerid);
SendRconCommand("reloadbans");
}
}
return 1;
}

CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new command[128], string[128], ip;
if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]");
{
format(string, sizeof(string), "aCMD: %s unbanned someone", Name(playerid));
SendClientMessageToAll(C_RED, string);
format(command,sizeof(command),"unbanip %s", ip);
SendRconCommand(command);
printf("UNBAN Executed by %i",playerid);
SendRconCommand("reloadbans");
}
}
return 1;
}


What is wrong?

Glad2BeHere
20/11/2012, 04:52 AM
if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]")



if(sscanf(params,"s[64]", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]")

EliteApple
20/11/2012, 04:53 AM
EDIT: Nevermind, wasn't paying attention to the code.

ownboy
20/11/2012, 05:05 AM
Glad2BeHere, that code doesn't work

ownboy
20/11/2012, 05:27 AM
Ok i fixed it :)

Old:
new command[128], string[128], ip;
if(sscanf(params,"us", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]");

New:
new command[128], string[128], ip[16];
if(sscanf(params,"s[16]", ip)) return SendClientMessage(playerid, C_WHITE, "USAGE: /unban [Banned IP]");