Jump to content
  • 0

pomoc Detekování IP


Jakub Kučera

Dotaz

Ahoj, mám problém,zkoušel jsem si udělat vlastní blokaci IP serverů v CHATU.

 

Bohužel, kód, který jsem použil mi nefungoval....

 

Potřeboval bych poradit, jak to udělat, aby to detekoval IP, ale i doménu s portem viz :

XX.XXX.XXX.XX:xxxx a i www.XXX.cz:xxxx

 

Děkuji za odpověď.

Link to comment
Share on other sites

6 odpovědí na tuto otázku

Recommended Posts

  • 0

Nemám to na serveru ,ale někde to nemají na celou IP ,ale jen na port ,což znamená ,že někdo musím napsat :7777(nebo jakýkoliv jiný port).

 

Udělej si nějaký rozmezí ,že pokud někdo napíše :1111-9999 tak mu to dá ban.

 

Mylsím ,že by to takhle mohlo stačit ,protože většina lidí(myslím si) používá hostingy  ,které na jednu IP dají více serverů,takže má každý jinou IP. ;) Snad ti to takhle stačí :d

Link to comment
Share on other sites

  • 0

A ty neumíš pawno?  Já to teďka dlouho nepoužíval ,tak je to pro mě španělská vesnice :d

 

Tady jsem něco našel :

 



#include <a_samp>




public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("         Anti-reklama by Om3n");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}



public OnPlayerText(playerid, text[])
{
//--------------------------------------------------------

	for(new ip1=1;ip1 < 9; ip1++)
	{
		for(new ip2=0;ip2 < 9; ip2++)
		{
            for(new ip3=0;ip3 < 9; ip3++)
			{
				for(new ip4=0;ip4 < 9; ip4++)
				{

					new string2[16];
					format(string2, sizeof(string2), ":%d%d%d%d", ip1, ip2, ip3, ip4);
					new string3[16];
					format(string3, sizeof(string3), ": %d%d%d%d", ip1, ip2, ip3, ip4);
					new string4[16];
					format(string4, sizeof(string3), ": %d %d %d %d", ip1, ip2, ip3, ip4);

					if(strfind(text, string2) >= 0)
					{
						SendClientMessage(playerid, 0xE10000AA, "Banned. No advertising .");
						SendClientMessage(playerid, 0xE10000AA, "For unban write to www.ZombiesEra.tk .");

						new string[256];
						format(string, sizeof(string), "advertising");
						BanEx(playerid, string);
                        return 0;
					}
					if(strfind(text, string3) >= 0)
					{
						SendClientMessage(playerid, 0xE10000AA, "Banned. No advertising .");
						SendClientMessage(playerid, 0xE10000AA, "For unban write to www.ZombiesEra.tk .");

						new string[256];
						format(string, sizeof(string), "advertising");
						BanEx(playerid, string);
                        return 0;
					}
					if(strfind(text, string4) >= 0)
					{
						SendClientMessage(playerid, 0xE10000AA, "Banned. No advertising .");
						SendClientMessage(playerid, 0xE10000AA, "For unban write to www.ZombiesEra.tk .");

						new string[256];
						format(string, sizeof(string), "advertising");
						BanEx(playerid, string);
                        return 0;
					}
				}
			}
		}

		
	}
	return 1;
}

 

 

Link to comment
Share on other sites

  • 0

nedávno sa to tu tiež jeden pýtal, tu máš to čo som mu napísal:

#include <a_samp>

new ReklamaZakazane[] = {
	"www.",
	".cz",
	".sk",
	".net",
	".com",
	".org",
};

public OnPlayerText(playerid, text[]) {
	for(new a = 1; a < 9; a++) {
		for(new b = 0; b < 9; b++) {
			for(new c = 0; c < 9; c++) {
				for(new d = 0; d < 9; d++) {
					new str1[16], str2[16], str3[16];
					format(str1, sizeof(str1), ":%d%d%d%d", a, b, c, d);
					format(str2, sizeof(str2), ": %d%d%d%d", a, b, c, d);
					format(str3, sizeof(str3), ": %d %d %d %d", a, b, c, d);
					if (strfind(text, str1) != -1 && strfind(text, str2) != -1 && strfind(text, str3) != -1) {
						new str[256], name[MAX_PLAYER_NAME];
						GetPlayerName(playerid, name, sizeof(name));
						format(str, sizeof(str), "Hráč %s bol kicknutý za reklamu!", name);
						SendClientMessageToAll(0xFF0000FF, str);
						Kick(playerid);
						return 0;
					}
				}
			}
		}
	}

	for (new i; i < sizeof(ReklamaZakazane); i++) {
		if (strfind(text, ReklamaZakazane[i], true) != -1) {
			new str[256], name[MAX_PLAYER_NAME];
			GetPlayerName(playerid, name, sizeof(name));
			format(str, sizeof(str), "Hráč %s bol kicknutý za reklamu!", name);
			SendClientMessageToAll(0xFF0000FF, str);
			Kick(playerid);
			return 0;
		}
	}
	return 1;
} 
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...