Jump to content

Anti Trocas/drop Com Gm


tierrilopes
 Share

Recommended Posts

Para impedir os GM de trocar com jogadores e/ou dropar itens para o chão.

 

Ir até ao ficheiro exchange.cpp:

Procurar por:


 

bool CHARACTER::ExchangeStart(LPCHARACTER victim)
{

 

Adicionar isto debaixo:

if (GetGMLevel() > GM_PLAYER || victim->GetGMLevel() > GM_PLAYER){
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));
	return false;}

 

Ir até ao ficheiro char_item.cpp:

Procurar por:

bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)
{

 

Adicionar isto debaixo:

if (GetGMLevel() > GM_PLAYER)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido dropar itens como GM."));
		return false;
	}
 
Link to comment
Share on other sites

  • 4 months later...

Alternativa para verificar nome das personagens:

 

Dropar itens:

bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)

{

std::string nNome = GetName();

if (GetGMLevel() > GM_PLAYER && nNome != "tierrilopes")

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido dropar itens como GM."));

return false;

}

 

Não permite aos GM dropar itens excepto se o nome do GM for tierrilopes.

 

Trocar itens:

std::string nNome = GetName();

if ((GetGMLevel() > GM_PLAYER && nNome != "tierrilopes") || (victim->GetGMLevel() > GM_PLAYER && nNome != "tierrilopes"))

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));

return false;

}

 

Não permite aos GM trocar itens excepto se o nome do GM for tierrilopes.

Nem os jogadores podem abrir o comercio com os GM.

Link to comment
Share on other sites

  • 3 weeks later...

Se fossem 2 seria?

 

std::string nNome = GetName();

if ((GetGMLevel() > GM_PLAYER && nNome != "tierrilopes") || (victim->GetGMLevel() > GM_PLAYER && nNome != "tierrilopes"))

if ((GetGMLevel() > GM_PLAYER && nNome != "kushina") || (victim->GetGMLevel() > GM_PLAYER && nNome != "kushina"))

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));

return false;

}

 

? *-*

Link to comment
Share on other sites

Eu tenho assim para duas personagens:

if(GetGMLevel() > GM_PLAYER && nNome != "charparodar" && nNome != "[Habira]") 
{
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com jogadores!"));
	return false;
}

if(victim->GetGMLevel() > GM_PLAYER)
{
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM's!"));
	return false;
}

Link to comment
Share on other sites

  • 3 months later...

 

Se fossem 2 seria?

 

std::string nNome = GetName();

if ((GetGMLevel() > GM_PLAYER && nNome != "tierrilopes") || (victim->GetGMLevel() > GM_PLAYER && nNome != "tierrilopes"))

if ((GetGMLevel() > GM_PLAYER && nNome != "kushina") || (victim->GetGMLevel() > GM_PLAYER && nNome != "kushina"))

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));

return false;

}

 

? *-*

 

Aconselho apenas a fazer um if

 

 

Assim :

 

if (GetGMLevel() > GM_PLAYER && GetName() != "tierrilopes") || (victim->GetGMLevel() > GM_PLAYER && GetName() != "tierrilopes" || GetGMLevel() > GM_PLAYER && GetName() != "nomedosegundo") || (victim->GetGMLevel() > GM_PLAYER && GetName() != "nomedosegundo" )

 

Assim em Adiante

Link to comment
Share on other sites

  • 2 months later...
Quote

 

Caso queira, é possível aplicar essa função aos GM's? O que é que quero dizer com isto.. é possível aplicar apenas às personagens com " [GM] " no nome?

 

Sim é possível.

 

Anti-Drop

bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)

{

std::string nNome = GetName();

if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick")

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido dropar itens como GM."));

return false;

}

 

Não permite dropar com a personagem "[GM]Nick"

 

Anti-Troca

std::string nNome = GetName();

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick"))

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));

return false;

}

 

Não permite a troca ao "[GM]Nick"

Nem os jogadores podem abrir o comercio com o GM.

Link to comment
Share on other sites

Anti-Drop

 

bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)

{

std::string nNome = GetName();

if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick")

if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick")

if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick")

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido dropar itens como GM."));

return false;

}

Anti-Troca

 

std::string nNome = GetName();

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick"))

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick"))

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick"))

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));

return false;

}

 

seria assim?

Link to comment
Share on other sites

Muito Obrigado ^^

 

como seria para 3 GMs/Joagadores?

bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)
{
std::string nNome = GetName();
if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3")
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido dropar itens como GM."));
		return false;
	}

std::string nNome = GetName();
if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER  && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3"))
{
	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));
	return false;
}

Link to comment
Share on other sites

 

Ele queria apenas todos os personagens que tivessem [GM] no nome, contudo isso não tem lógica, é mais fácil bloquear todos e desbloquear apenas as personagens que te interessam.

 

Pois feio foi o que pensei também, tanto que essa duvida já havia existido e o tierri ja tinha postado um codigo acima que faz exactamente isso.

 

 

Alternativa para verificar nome das personagens:

 

Dropar itens:

 

bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)

{

std::string nNome = GetName();

if (GetGMLevel() > GM_PLAYER && nNome != "tierrilopes")

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido dropar itens como GM."));

return false;

}

 

Não permite aos GM dropar itens excepto se o nome do GM for tierrilopes.

 

Trocar itens:

 

std::string nNome = GetName();

if ((GetGMLevel() > GM_PLAYER && nNome != "tierrilopes") || (victim->GetGMLevel() > GM_PLAYER && nNome != "tierrilopes"))

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));

return false;

}

 

Não permite aos GM trocar itens excepto se o nome do GM for tierrilopes.

Nem os jogadores podem abrir o comercio com os GM.

Link to comment
Share on other sites

 

Anti-Drop

 

bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)

{

std::string nNome = GetName();

if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick")

if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick")

if (GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick")

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido dropar itens como GM."));

return false;

}

Anti-Troca

 

std::string nNome = GetName();

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick"))

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick"))

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick"))

{

ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Proibido trocar itens com GM."));

return false;

}

 

seria assim?

 

Não, isso iria ser um erro, a forma correcta é adicionar deste modo:

 

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick" && && nNome == "[GM]Nick2"))

 

Porque ao adicionar mais linhas de if não estás a conseguir fazer o que queres, para fazer isso adicionas um operador relacional que neste caso é um (AND) E = &&.

 

Aproveitando o assunto deixo aqui outros operadores lógicos e relacionais

> Maior do que

>= Maior ou igual a

< Menor do que

<= Menor ou igual a

== Igual a

!= Diferente de

! NOT (Não)

|| OR (OU)

&& AND (E)

Link to comment
Share on other sites

 

Pelo que entendi penso que ele queira todas as personagens qe tenham essas letras e símbolos no nome, mas é mais prático e organizado fazer como o tierri fez.

 

Exacto, no entanto irei testar com "nomes" :)

 

 

_________________________

 

Testei, O GM em si não consegue negociar, mas outros jogadores conseguem negociar com ele.

Link to comment
Share on other sites

 

Exacto, no entanto irei testar com "nomes" :)

 

 

_________________________

 

Testei, O GM em si não consegue negociar, mas outros jogadores conseguem negociar com ele.

 

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3"))

 

para

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3") || (victim->GetGMLevel() > GM_PLAYER  && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3"))

Link to comment
Share on other sites

 

 

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3"))

 

para

 

if ((GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3") || (victim->GetGMLevel() > GM_PLAYER && nNome == "[GM]Nick" && nNome == "[GM]Nick2" && nNome == "[GM]Nick3"))

 

46f9c5720b3e494cb55d0b76eee381e7.png

 

 

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...