Ip Ban
#1

hey i need a command that can ban a IP (player not on server)
can someone help me?
Reply
#2

https://sampwiki.blast.hk/wiki/Controlli...r_Server#banip
Reply
#3

i need to know how it works
Reply
#4

So you want me to make a new cmd?
Reply
#5

if you can do this it was great ...
Reply
#6

you only need to login as rcon on your server and ban the ip O_o
or add the IP in the data named "samp.ban"
Reply
#7

lol i know this but i dont want that every admin get the rcon or the interface login
Reply
#8

Here you go: http://pawn.pastebin.com/d54232976
It is in dcmd:d

edit: mind indentation please(it is pastebin)
Reply
#9

not bad RKS
Reply
#10

Why the fuck make a new cmd when thers an RCON one?
Reply
#11

Quote:
Originally Posted by Mikep
Why the fuck make a new cmd when thers an RCON one?
Quote:
Originally Posted by Schock
lol i know this but i dont want that every admin get the rcon or the interface login
Reply
#12

/facepalm /run /hide
Reply
#13

pawn Код:
if(!strcmp(cmd,"/banip",true))
  {
    cmd=strtok(cmdtext,idx);
    if(!strlen(cmd)) return SendClientMessage(playerid,0xFFFFFFAA,"USAGE: /banip [player's IP]");
    format(string,sizeof(string),"banip %s",cmd);
    SendRconCommand(string);
    SendRconCommand("reloadbans");
    format(string,sizeof(string),"You've successfully banned the IP: %d",cmd);
    return SendClientMessage(playerid,0xFFFFFFAA,string);
  }
Reply
#14

Menace that code of yours don't compile if you haven't defined stuff. In comparison with mine.
ALSO: you can also feed numbers that is not an ip number, like 20000000191, it will try to send that in a string...
So a bit at the lower side.
Reply
#15

can you create it like this?
pawn Код:
if(strcmp(cmd, "/banip", true) == 0)
not in dcmd
Reply
#16

I prefer using dcmd more, i am better in it, to avoid faults or mistakes
You can also use dcmd, just define dcmd at top.
Reply
#17

Here we go

pawn Код:
if(strcmp(cmd, "/banipz", true) == 0)
    {

    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
       SendClientMessage(playerid,COLOR_GRAD1,"USAGE: /banip [IP]");
       return 1;
    }
    new icnt;
    for(new i = 0 , j = strlen(string); i < j; i++)
    {
        if(string[i] == '.')
        icnt++;
    }
    if(icnt != 3)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"That is not a valid IP address.");
        return 1;
    }
    if(strlen(string[0]) > 18)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"That is not a valid length for a IP address.");
        return 1;
    }
    new name[24];
    new banipstring[64];
    GetPlayerName(playerid,name,24);
    format(banipstring,64,"banip %s",string);
    format(string,128,"[BAN-IP] Name: %s || IP: %s",name,string);
    SendClientMessage(playerid,COLOR_WHITE,string);
    print(string);
    SendRconCommand(banipstring);
    return 1;
   
    }
Reply
#18

Thanks Danut, mind intentation btw.
Reply
#19

Код:
	if(strcmp(cmd, "/banip", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		giveplayerid = strval(tmp);
		new playerip[16];
		strmid(playerip, tmp, 0, strlen(tmp));
		new string2[256];
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /banip [ip]");
			return 1;
		}
		new playa;
		if(IsStringAName(tmp))
		{
			playa = GetPlayerID(tmp);
		}
		else
		{
			playa = strval(tmp);
		}
		GetPlayerName(playa, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		if (PlayerInfo[playerid][pAdmin] >= 1)
		{
			format(string, sizeof(string), "AdmCmd: %s Has been banned by %s", playerip, sendername);
			SendClientMessageToAll(COLOR_RED, string);
			format(string2, sizeof(string2), "banip %s", playerip);
			SendRconCommand(string2);
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
		}
		return 1;
	}
Reply
#20

That command is a bit messed up?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)