Jump to content

Como Bloquear o @mobsearch para um determinado monstro


Israel

Recommended Posts


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   0
  • Joined:  07/06/16
  • Last Seen:  

Olá meus amigo tenho o evento baú perdido e um evento onde um baú aparece no determinado mapa só que os jogadores usa o comando @mobsearch e ele acaba dando as coordenadas queria bloquear isso alguém pode ajudar por favor 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   14
  • Joined:  07/23/18
  • Last Seen:  

Posso te oferecer uma outra solução? Será que resolveria apenas bloqueando o @mobsearch no mapa do seu evento?

Se sim, acesse src/map/atcommand.cpp, procure @mobsearch e mude isso:

ACMD_FUNC(mobsearch)
{
	char mob_name[100];
	int mob_id;
	int number = 0;
	struct s_mapiterator* it;

	nullpo_retr(-1, sd);

	if (!message || !*message || sscanf(message, "%99[^\n]", mob_name) < 1) {
		clif_displaymessage(fd, msg_txt(sd,1218)); // Please enter a monster name (usage: @mobsearch <monster name>).
		return -1;
	}

	if ((mob_id = atoi(mob_name)) == 0)
		 mob_id = mobdb_searchname(mob_name);
	if( mobdb_checkid(mob_id) == 0){
		snprintf(atcmd_output, sizeof atcmd_output, msg_txt(sd,1219),mob_name); // Invalid mob ID %s!
		clif_displaymessage(fd, atcmd_output);
		return -1;
	}
	strcpy(mob_name,mob_db(mob_id)->jname);	// --ja--
//	strcpy(mob_name,mob_db(mob_id)->name);	// --en--

	snprintf(atcmd_output, sizeof atcmd_output, msg_txt(sd,1220), mob_name, mapindex_id2name(sd->mapindex)); // Mob Search... %s %s
	clif_displaymessage(fd, atcmd_output);

	it = mapit_geteachmob();
	for(;;)
	{
		TBL_MOB* md = (TBL_MOB*)mapit_next(it);
		if( md == NULL )
			break;// no more mobs

		if( md->bl.m != sd->bl.m )
			continue;
		if( md->mob_id != mob_id )
			continue;

		++number;
		if( md->spawn_timer == INVALID_TIMER )
			snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%3d:%3d] %s", number, md->bl.x, md->bl.y, md->name);
		else
			snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%s] %s", number, "dead", md->name);
		clif_displaymessage(fd, atcmd_output);
	}
	mapit_free(it);

	return 0;
}

Para isso:

ACMD_FUNC(mobsearch)
{
	char mob_name[100];
	int mob_id;
	int number = 0;
	struct s_mapiterator* it;

	nullpo_retr(-1, sd);

		if(sd->bl.m == map_mapname2mapid("mapadoseuevento")) {
		clif_displaymessage(fd, "Você não pode usar Mobsearch nesse mapa.");
		return -1;
	}
	
	if (!message || !*message || sscanf(message, "%99[^\n]", mob_name) < 1) {
		clif_displaymessage(fd, msg_txt(sd,1218)); // Please enter a monster name (usage: @mobsearch <monster name>).
		return -1;
	}

	if ((mob_id = atoi(mob_name)) == 0)
		 mob_id = mobdb_searchname(mob_name);
	if( mobdb_checkid(mob_id) == 0){
		snprintf(atcmd_output, sizeof atcmd_output, msg_txt(sd,1219),mob_name); // Invalid mob ID %s!
		clif_displaymessage(fd, atcmd_output);
		return -1;
	}
	strcpy(mob_name,mob_db(mob_id)->jname);	// --ja--
//	strcpy(mob_name,mob_db(mob_id)->name);	// --en--

	snprintf(atcmd_output, sizeof atcmd_output, msg_txt(sd,1220), mob_name, mapindex_id2name(sd->mapindex)); // Mob Search... %s %s
	clif_displaymessage(fd, atcmd_output);

	it = mapit_geteachmob();
	for(;;)
	{
		TBL_MOB* md = (TBL_MOB*)mapit_next(it);
		if( md == NULL )
			break;// no more mobs

		if( md->bl.m != sd->bl.m )
			continue;
		if( md->mob_id != mob_id )
			continue;

		++number;
		if( md->spawn_timer == INVALID_TIMER )
			snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%3d:%3d] %s", number, md->bl.x, md->bl.y, md->name);
		else
			snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%s] %s", number, "dead", md->name);
		clif_displaymessage(fd, atcmd_output);
	}
	mapit_free(it);

	return 0;
}

Alterando apenas o nome "mapadoseuevento" para o nome do mapa do seu evento. Lembrando que toda alteração na pasta src só é aplicada quando você recompila o seu emulador.

 

Bônus

Caso você precise bloquear em mais de um mapa, você pode copiar apenas essa parte:

		if(sd->bl.m == map_mapname2mapid("mapadoseuevento")) {
		clif_displaymessage(fd, "Você não pode usar Mobsearch nesse mapa.");
		return -1;
	}

E colar abaixo da outra (existe uma forma mais organizada, mas eu recomendo que faça assim por enquanto.

Esse código serve pra bloquear outros comandos também, por exemplo, no nosso servidor o uso do @duel é bloqueado em Prontera. Você só tem que ficar atento ao return que encerra o Script, em alguns comandos é -1, outros 0 ou 1.

Espero ter ajudado!

Edited by Tanlor
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

Fiz esse pequeno sistema com script sem precisar de modificar src, no final do código tem uma variável onde deve por os ids dos mobs no qual não queria que seja possível localizar pelo comando @mobsearch!

-	script	CtrlCommands	-1,{


OnCtrlLBL:

	if(.@atcmd_command$ != "@mobsearch") end;
	
	if(.@atcmd_parameters$[0] == "0" || .@atcmd_parameters$[0] == "")
	{ message strcharinfo(0),"[AVISO]: Digite um ID/NOME!"; end; }
	
	if(.@atcmd_parameters$[0] != "" && getgroupid() < 99)
	{
		if(!charisalpha(.@atcmd_parameters$[0],1)) set .@rscMBID,.@atcmd_parameters$[0]; else set .@rscMBID,0;
		for(set .@i,0; .@i<getarraysize(.NoMbSrh_ID); set .@i,.@i+1)
		{
			if(!.@rscMBID && strtolower(.@atcmd_parameters$[0]) == strtolower(strmobinfo(1,.NoMbSrh_ID[.@i])))
			{
				message strcharinfo(0),"[AVISO]: Você não pode procurar por este mob!"; end;
			}
			else if(.@rscMBID == .NoMbSrh_ID[.@i])
			{  message strcharinfo(0),"[AVISO]: Você não pode procurar por este mob!"; end; }
		}
	}	
	
	atcommand "@mobsearch "+.@atcmd_parameters$[0];
	end;


OnInit:

bindatcmd "@mobsearch",strnpcinfo(3)+"::OnCtrlLBL";

//MOB_ID
setarray .NoMbSrh_ID[0],1002,1031;

end;
}

 

 

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.01
  • Content Count:  33
  • Reputation:   0
  • Joined:  07/06/16
  • Last Seen:  

@Hyroshima ficou top muito obrigado valeu mesmo

 

Link to comment
Share on other sites

  • 3 months later...

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  11
  • Reputation:   0
  • Joined:  11/03/14
  • Last Seen:  

Funcionou mas está dando pra burlar, se você colocar o nome do MOB no lugar do ID ele passa

Edit: Perdão foi error meu, está funcionando perfeitamente

Edited by ADM Deku
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...