• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

You cannot attack your guild tfs 1.2 by celehore

Put 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
 
Put 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
I just put this part and compiled the source, thanks a lot
// Verify if the player have the same guild
if (attacker->getPlayer() && attacker->getPlayer()->getGuild() == target->getPlayer()->getGuild()) {
return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER;
 
bool Combat::isProtected in combat.cpp already check if player isProtected or not

Just update it to:

C++:
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;
}
 
Back
Top