SA-MP Forums Archive
Ip Ban - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Ip Ban (/showthread.php?tid=67425)



Ip Ban - Schock - 01.03.2009

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


Re: Ip Ban - Mikep - 01.03.2009

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


Re: Ip Ban - Schock - 01.03.2009

i need to know how it works


Re: Ip Ban - Rks25 - 01.03.2009

So you want me to make a new cmd?


Re: Ip Ban - Schock - 01.03.2009

if you can do this it was great ...


Re: Ip Ban - DarkSnow - 01.03.2009

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"



Re: Ip Ban - Schock - 01.03.2009

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


Re: Ip Ban - Rks25 - 01.03.2009

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

edit: mind indentation please(it is pastebin)


Re: Ip Ban - DarkSnow - 01.03.2009

not bad RKS


Re: Ip Ban - Mikep - 01.03.2009

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


Re: Ip Ban - boylett - 01.03.2009

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



Re: Ip Ban - Mikep - 01.03.2009

/facepalm /run /hide


Re: Ip Ban - MenaceX^ - 01.03.2009

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);
  }



Re: Ip Ban - Rks25 - 01.03.2009

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.


Re: Ip Ban - Schock - 02.03.2009

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


Re: Ip Ban - Rks25 - 02.03.2009

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.


Re: Ip Ban - Danut - 02.03.2009

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;
   
    }



Re: Ip Ban - Rks25 - 02.03.2009

Thanks Danut, mind intentation btw.


Re: Ip Ban - Think - 02.03.2009

Код:
	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;
	}



Re: Ip Ban - Rks25 - 02.03.2009

That command is a bit messed up?