Mateus Robeerto
Legendary OT User
does anyone know where i can find the script that can't attack each other in the same guild??
ReturnValue Combat::canDoCombat(Creature* attacker, Creature* target)
{
// ...
if (target->getPlayer()) {
if (isProtected(attacker, target->getPlayer())) {
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER;
}
// Verify if the player have the same guild
if (attacker->getPlayer() && attacker->getPlayer()->getGuild() == target->getPlayer()->getGuild()) {
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER;
}
// The other code...
}
// ...
}
I just put this part and compiled the source, thanks a lotPut before all the code: #include "guild.h"
I guess u need to edit your source combat.cpp
C++:ReturnValue Combat::canDoCombat(Creature* attacker, Creature* target) { // ... if (target->getPlayer()) { if (isProtected(attacker, target->getPlayer())) { return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER; } // Verify if the player have the same guild if (attacker->getPlayer() && attacker->getPlayer()->getGuild() == target->getPlayer()->getGuild()) { return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER; } // The other code... } // ... }
I tested it in TFS 1.4
// Verify if the player have the same guild
if (attacker->getPlayer() && attacker->getPlayer()->getGuild() == target->getPlayer()->getGuild()) {
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER;
Does it work on tfs 1.5 nekiro's? xD
I just put this part and compiled the source, thanks a lot
bool Combat::isProtected(const Player* attacker, const Player* target)
{
uint32_t protectionLevel = g_config.getNumber(ConfigManager::PROTECTION_LEVEL);
if (target->getLevel() < protectionLevel || attacker->getLevel() < protectionLevel) {
return true;
}
if (!attacker->getVocation()->allowsPvp() || !target->getVocation()->allowsPvp()) {
return true;
}
if (attacker->getSkull() == SKULL_BLACK && attacker->getSkullClient(target) == SKULL_NONE) {
return true;
}
// new check
if (attacker->getGuild() && target->getGuild() && attacker->getGuild() == target->getGuild()) {
return true;
}
return false;
}