[Ajuda] Fiz do jeito certo? Anti divulgaзгo
#1

Queria ajuda de gente experiente, to tentando fazer um sistema anti divulgaзгo, qm souber me ajuda ai, me diz se vai funcionar, fiz certo e fiz da melhor forma, vlw brothers abaixo segue o codigo

Код:
#defin NUMEROS_ANTIDV 432
new IP[NUMEROS_ANTIDV][] =
{
":7798",
":7777",
":7778",
":7776",
":7775",
":7774",
":7773",
":7772",
":7771",
":7770",
":5555",
":8888",
":8090",
":6969",
":7780",
":7781",
":7782",
":7783",
":7784",
":7785",
":7786",
":7787",
":7788",
":7789",
":7790",
":7791",
":7792",
":7793",
":7794",
":7795",
":7796",
":7797",
":7798",
":7799",
":7800",
"127.",
"189.",
"188.",
"198.",
"199.",
"171.",
"211.",
"64.",
"66.",
"68.",
"67.",
"65.",
"183.",
"187.",
"201.",
"211.",
"200.",
"141.",
"217.",
"213.",
"80.",
"8080.",
"127 .",
"189 .",
"188 .",
"198 .",
"199 .",
"171 .",
"211 .",
"64 .",
"66 .",
"68 .",
"67 .",
"65 .",
"183 .",
"187 .",
"201 .",
"211 .",
"200 .",
"141 .",
"217 .",
"213 .",
"80 .",
"8080 .",
"189.1.169",
"35:7777",
"1.169.35",
"189.1",
"88",
"77",
"7777",
"7 7",
"8 8",
"189.1.169.35:7777",
"200.",
"200 .",
"189.",
"189 .",
"201.",
"201 .",
"200.1",
"200.1",
"200 . 1",
"200. 1",
"200 .1",
"201.1",
"201 . 1",
"201. 1",
"201 .1",
"208.1",
"208. 1",
"208 .1",
"208 . 1",
"69.1",
"69. 1",
"69 . 1",
"69 .1",
"189.1",
"189. 1",
"189 .1",
"189 . 1",
"66.7",
"66. 7",
"66 .7",
"66 . 7",
"177.1",
"177. 1",
"177 .1",
"177 . 1",
"109 .",
"115 .",
"119 .",
"128 .",
"133 .",
"140 .",
"149 .",
"65 .",
"32 .",
"66 .",
":3127",
"150 .",
"156 .",
"167 .",
"173 .",
"174 .",
"184 .",
"187 .",
"189 .",
"193 .",
"195 .",
"198 .",
"199 .",
"200 .",
"201 .",
"202 .",
"203 .",
"204 .",
"205 .",
"206 .",
"209 .",
"210 .",
"212 .",
"213 .",
"218 .",
"219 .",
"41 .",
"46 .",
"58 .",
"59 .",
"61 .",
"70 .",
"72 .",
"75 .",
"77 .",
"78 .",
"79 .",
"80 .",
"83 .",
"84 .",
"85 .",
"87 .",
"92 .",
"94 .",
"95 .",
"98 .",
"99 .",
"124 .",
"256 .",
"512 .",
"102 .",
":3128",
"211 .",
"194 .",
"202 .",
"146 .",
"169 .",
"195 .",
"152 .",
"222 .",
"83 .",
"221 .",
"211 .",
"134 .",
"110 .",
"8 .",
"164 .",
"109-",
"115-",
"119-",
"128-",
"133-",
"140-",
"149-",
"65-",
"32-",
"66-",
":3127",
"150-",
"156-",
"167-",
"173-",
"174-",
"184-",
"187-",
"189-",
"193-",
"195-",
"198-",
"199-",
"200-",
"201-",
"202-",
"203-",
"204-",
"205-",
"206-",
"209-",
"210-",
"212-",
"213-",
"218-",
"219-",
"41-",
"46-",
"58-",
"59-",
"61-",
"70-",
"72-",
"75-",
"77-",
"78-",
"79-",
"80-",
"83-",
"84-",
"85-",
"87-",
"92-",
"94-",
"95-",
"98-",
"99-",
"124-",
"256-",
"512-",
"102-",
":3128",
"211-",
"194-",
"202-",
"146-",
"169-",
"195-",
"152-",
"222-",
"83-",
"221-",
"211-",
"134-",
"110-",
"8-",
"164-",
"109.",
"115.",
"119.",
"128.",
"133.",
"140.",
"149.",
"65.",
"32.",
"66.",
":3127",
"150.",
"156.",
"167.",
"173.",
"174.",
"184.",
"187.",
"189.",
"193.",
"195.",
"198.",
"199.",
"200.",
"201.",
"202.",
"203.",
"204.",
"205.",
"206.",
"209.",
"210.",
"212.",
"213.",
"218.",
"219.",
"41.",
"46.",
"58.",
"59.",
"61.",
"70.",
"72.",
"75.",
"77.",
"78.",
"79.",
"80.",
"83.",
"84.",
"85.",
"87.",
"92.",
"94.",
"95.",
"98.",
"99.",
"124.",
"256.",
"512.",
"102.",
":3128",
"211.",
"194.",
"202.",
"146.",
"169.",
"195.",
"152.",
"222.",
"83.",
"221.",
"211.",
"134.",
"110.",
"8.",
"164.",
"109  .",
"115  .",
"119  .",
"128  .",
"133  .",
"140  .",
"149  .",
"65  .",
"32  .",
"66  .",
":3127",
"150  .",
"156  .",
"167  .",
"173  .",
"174  .",
"184  .",
"187  .",
"189  .",
"193  .",
"195  .",
"198  .",
"199  .",
"200  .",
"201  .",
"202  .",
"203  .",
"204  .",
"205  .",
"206  .",
"209  .",
"210  .",
"212  .",
"213  .",
"218  .",
"219  .",
"41  .",
"46  .",
"58  .",
"59  .",
"61  .",
"70  .",
"72  .",
"75  .",
"77  .",
"78  .",
"79  .",
"80  .",
"83  .",
"84  .",
"85  .",
"87  .",
"92  .",
"94  .",
"95  .",
"98  .",
"99  .",
"124  .",
"256  .",
"512  .",
"102  .",
":3128",
"211  .",
"194  .",
"202  .",
"146  .",
"169  .",
"195  .",
"152  .",
"222  .",
"83  .",
"221  .",
"211  .",
"134  .",
"110  .",
"8  .",
"164  ."
};



public OnPlayerCommandText(playerid, cmdtext[])
{
	for(new fdp=0;fdp < NUMEROS_ANTIDV; fdp++){
		if(strfind(cmdtext, IP[fdp], true) != -1)
		{
			new string[256];
			new ipdivulgado[512], ipdocara[128];
			GetPlayerIp(playerid,ipdocara,128);
			format(ipdivulgado, 256, "%s", cmdtext);

			format(string,sizeof(string),"[AUTO-BAN] (%s) %s divulgando: %s", ipdocara, PlayerName(playerid), ipdivulgado);
			ABroadCast(COLOR_LIGHTGREEN,bstring,1);
			writeLog("LOGS/divulgou.txt",string);
			// pra crashar o cara
			SetPlayerPos(playerid, 1,1,1);
			SetPlayerHoldingObject(playerid, 305, 1);
			// pra banir o cara
			banned[playerid] = 1;
			expirarban[playerid] = gettime() + (7 * 86400);
			Ban(playerid);
			return 1;
		}
	}
}

public OnPlayerText(playerid, text[])
{
	for(new fdp=0;fdp < NUMEROS_ANTIDV; fdp++){
		if(strfind(text, IP[fdp], true) != -1)
		{
			new string[256];
			new ipdivulgado[512], ipdocara[128];
			GetPlayerIp(playerid,ipdocara,128);
			format(ipdivulgado, 256, "%s", cmdtext);

			format(string,sizeof(string),"[AUTO-BAN] (%s) %s divulgando: %s", ipdocara, PlayerName(playerid), ipdivulgado);
			ABroadCast(COLOR_LIGHTGREEN,bstring,1);
			writeLog("LOGS/divulgou.txt",string);
			// pra crashar o cara
			SetPlayerPos(playerid, 1,1,1);
			SetPlayerHoldingObject(playerid, 305, 1);
			// pra banir o cara
			banned[playerid] = 1;
			expirarban[playerid] = gettime() + (7 * 86400);
			Ban(playerid);
			return 1;
		}
	}
}
Reply
#2

fiz com base nesse scirpt aqui, pressupondo que ele funcionasse

http://pastebin.com/RCy7Hu4L
Reply
#3

Seria melhor vocк mesmo testб-lo, primeiro compilando o cуdigo, depois no prуprio jogo...

#defin
#define
Reply
#4

Код:
new numer[][]={"0","1","2","3","4","5","6","7","8","9"};
for(new i; i < strlen(text); i++)
{ 
if(strlen(text[i])>4 && strfind(text[i],".",true) != -1 || strfind(text[i],":", true)!= -1)
{
for (new x=0; x < 1; x++)
{
if strfind(text[i] , numer[x], true) != -1)
{
SendClientMessage(playerid,-1,"proibida"); 
return false;
}
}
}
}
Postei isso via celular. Identa ae

OBS: coloque na OnPlayerText
Reply
#5

Ok moзada nгo foi ele que fez, acho que ele ja entendeu, agora como vamos ajuda-lo ?
Код:
new IpProibidos[][] =
{
{"7777"}
};
Vai colocando os ip's que vc quer sempre assim {"9999"}, o ip entre aspas viu.
@edit
Coloque virgulas viu.
Reply
#6

Desculpa a todos que apontaram o dedo, programadores profissionais, sу peguei a array declarada e fiz de forma parecida com o loop com as variбveis com o msm nome, justamente pq fiz olhando o outro cуdigo

Quote:
Originally Posted by Q.I
Посмотреть сообщение
Код:
new numer[][]={"0","1","2","3","4","5","6","7","8","9"};
for(new i; i < strlen(text); i++)
{ 
if(strlen(text[i])>4 && strfind(text[i],".",true) != -1 || strfind(text[i],":", true)!= -1)
{
for (new x=0; x < 1; x++)
{
if strfind(text[i] , numer[x], true) != -1)
{
SendClientMessage(playerid,-1,"proibida"); 
return false;
}
}
}
}
Postei isso via celular. Identa ae

OBS: coloque na OnPlayerText
Parece estar funcionando +rep

Tentei adapta-lo em meu GM porйm nгo tive sucesso, poderia me ajudar? Olha como eu fiz....
Coloquei a partir de funзгo para que possa usar nгo sу em onplayertext e tambйm em comandos como /pm e etc

Porйm tive 2 problemas:
1- As msgs estгo indo, msm passando pelo filtro (avisa os adms, mas a msg vai)
2- Qnd й usado sem ser em onplayertext como no exemplo do /pm nгo ta detectando

Код:
forward AntiDivulga(playerid, msg[]);
public AntiDivulga(playerid, msg[]) {
	// anti divulgaзгo
	new numer[][]={"0","1","2","3","4","5","6","7","8","9"};
	for(new i; i < strlen(msg); i++)
	{
		if(strlen(msg[i])>4 && strfind(msg[i],".",true) != -1 || strfind(msg[i],":", true)!= -1 || strfind(msg[i],",", true)!= -1 || strfind(msg[i],"-", true)!= -1
		 || strfind(msg[i],"_", true)!= -1 || strfind(msg[i],"*", true)!= -1 || strfind(msg[i],"'", true)!= -1 || strfind(msg[i],"/", true)!= -1)
		{
			for (new x=0; x < 1; x++)
			{
				if (strfind(msg[i] , numer[x], true) != -1)
				{
					new string[256];
					new ipdivulgado[512], ipdocara[128];
					GetPlayerIp(playerid,ipdocara,128);
					format(ipdivulgado, 256, "%s", msg);

					format(string,sizeof(string),"[AUTO-KICK] (%s) %s divulgando: %s", ipdocara, PlayerName(playerid), ipdivulgado);
					ABroadCast(COLOR_LIGHTGREEN,string,1);
					writeLog("LOGS/divulgou.txt",string);
					SendClientMessage(playerid, COLOR_GREY, "Divulga nгo.");
					// pra crashar o cara ?
					// Kick(playerid);
					return 0;
				}
			}
		}
	}
	return 1;
}
Код:
public OnPlayerText(playerid, text[])
{
	AntiDivulga(playerid, text);
	
	new string[128];
    format(string, sizeof(string), "%s(ID:%i): %s", PlayerName(playerid), playerid, text);
    ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && morto[playerid] == 0)
	{
		ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,0,0,0,1,1);
	}
    return 0;

}
Код:
	CMD:pm(playerid, params[]) {
        new string[128];
        new salvoid;
        new Mensagem[128];
        if(sscanf(params,"us[128]", salvoid, Mensagem)) {
            SendClientMessage(playerid, -1, "Use: /pm [id] [text]");
            return 1;
        }
        format(string, sizeof(string), "(PM)(E) %s [%d] %s", PlayerName(salvoid),salvoid,Mensagem);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        format(string, sizeof(string), "(PM)® %s [%d] %s", PlayerName(playerid),playerid,Mensagem);
        SendClientMessage(salvoid, COLOR_YELLOW, string);

        PlayerPlaySound(playerid, 3600, 0.0, 0.0, 0.0);
        PlayerPlaySound(salvoid, 1085, 0.0, 0.0, 0.0);
        return 1;
    }
Reply
#7

Quote:
Originally Posted by luccagomes15
Посмотреть сообщение
Desculpa a todos que apontaram o dedo, programadores profissionais, sу peguei a array declarada e fiz de forma parecida com o loop com as variбveis com o msm nome, justamente pq fiz olhando o outro cуdigo




Parece estar funcionando +rep

Tentei adapta-lo em meu GM porйm nгo tive sucesso, poderia me ajudar? Olha como eu fiz....
Coloquei a partir de funзгo para que possa usar nгo sу em onplayertext e tambйm em comandos como /pm e etc

Porйm tive 2 problemas:
1- As msgs estгo indo, msm passando pelo filtro (avisa os adms, mas a msg vai)
2- Qnd й usado sem ser em onplayertext como no exemplo do /pm nгo ta detectando

Код:
forward AntiDivulga(playerid, msg[]);
public AntiDivulga(playerid, msg[]) {
	// anti divulgaзгo
	new numer[][]={"0","1","2","3","4","5","6","7","8","9"};
	for(new i; i < strlen(msg); i++)
	{
		if(strlen(msg[i])>4 && strfind(msg[i],".",true) != -1 || strfind(msg[i],":", true)!= -1 || strfind(msg[i],",", true)!= -1 || strfind(msg[i],"-", true)!= -1
		 || strfind(msg[i],"_", true)!= -1 || strfind(msg[i],"*", true)!= -1 || strfind(msg[i],"'", true)!= -1 || strfind(msg[i],"/", true)!= -1)
		{
			for (new x=0; x < 1; x++)
			{
				if (strfind(msg[i] , numer[x], true) != -1)
				{
					new string[256];
					new ipdivulgado[512], ipdocara[128];
					GetPlayerIp(playerid,ipdocara,128);
					format(ipdivulgado, 256, "%s", msg);

					format(string,sizeof(string),"[AUTO-KICK] (%s) %s divulgando: %s", ipdocara, PlayerName(playerid), ipdivulgado);
					ABroadCast(COLOR_LIGHTGREEN,string,1);
					writeLog("LOGS/divulgou.txt",string);
					SendClientMessage(playerid, COLOR_GREY, "Divulga nгo.");
					// pra crashar o cara ?
					// Kick(playerid);
					return 0;
				}
			}
		}
	}
	return 1;
}
Код:
public OnPlayerText(playerid, text[])
{
	AntiDivulga(playerid, text);
	
	new string[128];
    format(string, sizeof(string), "%s(ID:%i): %s", PlayerName(playerid), playerid, text);
    ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && morto[playerid] == 0)
	{
		ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,0,0,0,1,1);
	}
    return 0;

}
Код:
	CMD:pm(playerid, params[]) {
        new string[128];
        new salvoid;
        new Mensagem[128];
        if(sscanf(params,"us[128]", salvoid, Mensagem)) {
            SendClientMessage(playerid, -1, "Use: /pm [id] [text]");
            return 1;
        }
        format(string, sizeof(string), "(PM)(E) %s [%d] %s", PlayerName(salvoid),salvoid,Mensagem);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        format(string, sizeof(string), "(PM)® %s [%d] %s", PlayerName(playerid),playerid,Mensagem);
        SendClientMessage(salvoid, COLOR_YELLOW, string);

        PlayerPlaySound(playerid, 3600, 0.0, 0.0, 0.0);
        PlayerPlaySound(salvoid, 1085, 0.0, 0.0, 0.0);
        return 1;
    }
Coloque do jeito que eu coloquei que nгo constarб erro. Olha e no comando use tambйm o cуdigo coloque o cуdigo antes das variaveis de enviar ao outro player .



Obs: no comando de enviar mensagem troque. O return false por return true. Aquele embaixo da mensagem de aviso. . Negуcios que estou via celular ai fica foda.
Reply
#8

o codigo vai ficar bem porco se nгo usado por funзхes, vai gastar mais linhas e dar mais trabalhos na manutenзгo por falta de conhecimento vc vai se ferrar dps, nгo sei trabalhar com strings, se n te ajudava
Reply
#9

Quote:
Originally Posted by maikons
Посмотреть сообщение
o codigo vai ficar bem porco se nгo usado por funзхes, vai gastar mais linhas e dar mais trabalhos na manutenзгo por falta de conhecimento vc vai se ferrar dps, nгo sei trabalhar com strings, se n te ajudava
Por isso que eu queria fazer por funзгo, atй pq se eu mudar algo, mudo sу na funзгo tbm
Reply
#10

Quote:
Originally Posted by luccagomes15
Посмотреть сообщение
Desculpa a todos que apontaram o dedo, programadores profissionais, sу peguei a array declarada e fiz de forma parecida com o loop com as variбveis com o msm nome, justamente pq fiz olhando o outro cуdigo




Parece estar funcionando +rep

Tentei adapta-lo em meu GM porйm nгo tive sucesso, poderia me ajudar? Olha como eu fiz....
Coloquei a partir de funзгo para que possa usar nгo sу em onplayertext e tambйm em comandos como /pm e etc

Porйm tive 2 problemas:
1- As msgs estгo indo, msm passando pelo filtro (avisa os adms, mas a msg vai)
2- Qnd й usado sem ser em onplayertext como no exemplo do /pm nгo ta detectando

Код:
forward AntiDivulga(playerid, msg[]);
public AntiDivulga(playerid, msg[]) {
	// anti divulgaзгo
	new numer[][]={"0","1","2","3","4","5","6","7","8","9"};
	for(new i; i < strlen(msg); i++)
	{
		if(strlen(msg[i])>4 && strfind(msg[i],".",true) != -1 || strfind(msg[i],":", true)!= -1 || strfind(msg[i],",", true)!= -1 || strfind(msg[i],"-", true)!= -1
		 || strfind(msg[i],"_", true)!= -1 || strfind(msg[i],"*", true)!= -1 || strfind(msg[i],"'", true)!= -1 || strfind(msg[i],"/", true)!= -1)
		{
			for (new x=0; x < 1; x++)
			{
				if (strfind(msg[i] , numer[x], true) != -1)
				{
					new string[256];
					new ipdivulgado[512], ipdocara[128];
					GetPlayerIp(playerid,ipdocara,128);
					format(ipdivulgado, 256, "%s", msg);

					format(string,sizeof(string),"[AUTO-KICK] (%s) %s divulgando: %s", ipdocara, PlayerName(playerid), ipdivulgado);
					ABroadCast(COLOR_LIGHTGREEN,string,1);
					writeLog("LOGS/divulgou.txt",string);
					SendClientMessage(playerid, COLOR_GREY, "Divulga nгo.");
					// pra crashar o cara ?
					// Kick(playerid);
					return 0;
				}
			}
		}
	}
	return 1;
}
Код:
public OnPlayerText(playerid, text[])
{
	AntiDivulga(playerid, text);
	
	new string[128];
    format(string, sizeof(string), "%s(ID:%i): %s", PlayerName(playerid), playerid, text);
    ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && morto[playerid] == 0)
	{
		ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,0,0,0,1,1);
	}
    return 0;

}
Код:
	CMD:pm(playerid, params[]) {
        new string[128];
        new salvoid;
        new Mensagem[128];
        if(sscanf(params,"us[128]", salvoid, Mensagem)) {
            SendClientMessage(playerid, -1, "Use: /pm [id] [text]");
            return 1;
        }
        format(string, sizeof(string), "(PM)(E) %s [%d] %s", PlayerName(salvoid),salvoid,Mensagem);
        SendClientMessage(playerid, COLOR_YELLOW, string);

        format(string, sizeof(string), "(PM)® %s [%d] %s", PlayerName(playerid),playerid,Mensagem);
        SendClientMessage(salvoid, COLOR_YELLOW, string);

        PlayerPlaySound(playerid, 3600, 0.0, 0.0, 0.0);
        PlayerPlaySound(salvoid, 1085, 0.0, 0.0, 0.0);
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)