BanIP help. - 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 help. (
/showthread.php?tid=416183)
BanIP help. -
PaulDinam - 16.02.2013
WHen I ban IP myself and trying to reconnect it still works..
Re: BanIP help. -
DaRk_RaiN - 16.02.2013
Show the /ban command.
Re: BanIP help. -
PaulDinam - 16.02.2013
Код:
CMD:banip(playerid, params[])
{
if(!CheckAdmin(playerid, 1)) return NotAuthMSG(playerid);
new ip[128],pIP[128],string[128];
if(sscanf(params,"s[128]",ip)) return SyntaxMSG(playerid, "/banip [IP]");
format(string, sizeof(string),"banip %s", ip);
SendRconCommand(string);
SendRconCommand("reloadbans");
format(string, sizeof(string), "AdmCmd: %s has just IP banned, %s.", GetName(playerid), ip);
AMSG(COLOR_LIGHTRED, string);
foreach(Player, i)
{
GetPlayerIp(playerid, pIP, sizeof(pIP));
if(!strcmp(ip, pIP, true))
{
format(string, sizeof(string), "[SERVER]: Your IP %s, has been banned from the server.", pIP);
KickEx(playerid, string);
}
}
return 1;
}
Re: BanIP help. -
Mean - 16.02.2013
pawn Код:
CMD:banip(playerid, params[]) {
if(!CheckAdmin(playerid, 1)) return NotAuthMSG(playerid);
new ip[20], pIP[20], str[128];
if(sscanf(params, "s[20]", ip)) return SyntaxMSG(playerid, "/banip [IP]");
foreach(Player, i) {
GetPlayerIp(i, pIP, sizeof(pIP));
if(!strcmp(ip, pIP, true)) SendClientMessage(i, -1, "[SERVER]: Your IP address has been banned from the server.");
}
format(str, sizeof str, "banip %s", pIP);
SendRconCommand(str);
SendRconCommand("reloadbans");
return 1;
}
btw: AFAIK you don't have to kick the player as he will timeout.
btw2: you were using "playerid" in the loop
Re: BanIP help. -
Scenario - 16.02.2013
Quote:
Originally Posted by Mean
pawn Код:
CMD:banip(playerid, params[]) { if(!CheckAdmin(playerid, 1)) return NotAuthMSG(playerid); new ip[20], pIP[20], str[128]; if(sscanf(params, "s[20]", ip)) return SyntaxMSG(playerid, "/banip [IP]"); foreach(Player, i) { GetPlayerIp(i, pIP, sizeof(pIP)); if(!strcmp(ip, pIP, true)) SendClientMessage(i, -1, "[SERVER]: Your IP address has been banned from the server."); } format(str, sizeof str, "banip %s", pIP); SendRconCommand(str); SendRconCommand("reloadbans"); return 1; }
AFAIK you don't have to kick the player as he will timeout.
|
Which isn't as "clean" as just kicking the player right then and there.
OT: Is your IP listed in the ban file?
Re: BanIP help. -
RACGaming - 16.02.2013
Replace
pawn Код:
format(string, sizeof(string),"banip %s", ip);
with
pawn Код:
format(string, sizeof(string),"banip %d", ip);
Because: %s is for a word or name and like this, but %d is for a number/integar
Re: BanIP help. -
Mean - 16.02.2013
Quote:
Originally Posted by RACGaming
Replace
pawn Код:
format(string, sizeof(string),"banip %s", ip);
with
pawn Код:
format(string, sizeof(string),"banip %d", ip);
Because: %s is for a word or name and like this, but %d is for a number/integar
|
IP is a string.
https://sampwiki.blast.hk/wiki/GetPlayerIp
GetPlayerIp(playerid, name
[],
len)
Re: BanIP help. -
2KY - 16.02.2013
Quote:
Originally Posted by RACGaming
Replace
pawn Код:
format(string, sizeof(string),"banip %s", ip);
with
pawn Код:
format(string, sizeof(string),"banip %d", ip);
Because: %s is for a word or name and like this, but %d is for a number/integar
|
https://sampwiki.blast.hk/wiki/GetPlayerIp
I suggest you read that.
Re: BanIP help. -
PaulDinam - 16.02.2013
well, even though my IP is on samp.ban , I can still connect my own server.
going to test with a friend
Re: BanIP help. -
Jefff - 16.02.2013
You cant ban 127.0.0.1 in 0.3x