BanIP - 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: BanIP (
/showthread.php?tid=335324)
BanIP -
TyThaBomb - 18.04.2012
So, I've made this command, but when I /banip, it sends that "Admin %s has banned IP ( [%s ) when I don't have a "[" in sight. Any ideas?
EDIT: Also sent "Banned IP [insertIPhere" in RCON.
pawn Код:
if(strcmp(cmd, "/banip", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " <| USAGE: /banip [ip] |>");
return 1;
}
if(PlayerStats[playerid][pAdmin] >= 6)
{
new ip;
ip = strval(tmp);
format(string, sizeof(string), "banip %s", ip);
SendRconCommand(string);
SendRconCommand("reloadbans");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), " <| Admin %s has banned IP: ( %s ) |>", sendername, ip);
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " <| You must be an Administrator to use this command! |>");
return 1;
}
}
return 1;
}
Re: BanIP -
PrawkC - 18.04.2012
When you're using the command ingame, what are you typing ?
Re: BanIP -
TyThaBomb - 18.04.2012
Quote:
Originally Posted by PrawkC
When you're using the command ingame, what are you typing ?
|
/banip iphere
Example: /banip 127.0.0.1
Re: BanIP -
SuperViper - 18.04.2012
pawn Код:
if(strcmp(cmd, "/banip", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " <| USAGE: /banip [ip] |>");
return 1;
}
if(PlayerStats[playerid][pAdmin] >= 6)
{
format(string, sizeof(string), "banip %s", tmp);
SendRconCommand(string);
SendRconCommand("reloadbans");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), " <| Admin %s has banned IP: ( %s ) |>", sendername, tmp);
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " <| You must be an Administrator to use this command! |>");
return 1;
}
}
return 1;
}
Re: BanIP -
TyThaBomb - 18.04.2012
Quote:
Originally Posted by SuperViper
pawn Код:
if(strcmp(cmd, "/banip", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, " <| USAGE: /banip [ip] |>"); return 1; } if(PlayerStats[playerid][pAdmin] >= 6) { format(string, sizeof(string), "banip %s", tmp); SendRconCommand(string); SendRconCommand("reloadbans"); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), " <| Admin %s has banned IP: ( %s ) |>", sendername, tmp); SendClientMessageToAll(COLOR_LIGHTRED, string); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " <| You must be an Administrator to use this command! |>"); return 1; } } return 1; }
|
Worked spot on, thanks so much, I appreciate it.