• 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!

C++ allowFightBack

Makin

New Member
Joined
Sep 17, 2018
Messages
37
Solutions
1
Reaction score
2
Hello, as you can see in the video, my problem

player.cpp
Code:
void Player::onAttackedCreature(Creature* target)
{
    Creature::onAttackedCreature(target);

    if (target->getZone() == ZONE_PVP) {
        return;
    }

    if (target == this) {
        addInFightTicks();
        return;
    }

    if (hasFlag(PlayerFlag_NotGainInFight)) {
        return;
    }

    Player* targetPlayer = target->getPlayer();
    if (targetPlayer && !isPartner(targetPlayer) && !isGuildMate(targetPlayer)) {
        if (!pzLocked && g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
            pzLocked = true;
            sendIcons();
        }

        if (getSkull() == SKULL_NONE && hasCondition(CONDITION_INFIGHT) && getSkullClient(targetPlayer) == SKULL_YELLOW) {
            addAttacked(targetPlayer);
            targetPlayer->sendCreatureSkull(this);
        } else if ((!targetPlayer->hasAttacked(this)) || (!g_config.getBoolean(ConfigManager::ALLOW_FIGHT_BACK))) {
            if (!pzLocked) {
                pzLocked = true;
                sendIcons();
            }

            if (!Combat::isInPvpZone(this, targetPlayer) && !isInWar(targetPlayer)) {
                addAttacked(targetPlayer);

                if (targetPlayer->getSkull() == SKULL_NONE && getSkull() == SKULL_NONE) {
                    setSkull(SKULL_WHITE);
                }

                if (getSkull() == SKULL_NONE) {
                    targetPlayer->sendCreatureSkull(this);
                }
            }
        }
    }

    addInFightTicks();
}
 
Incomplete problem description, rule 5 of support board.
You can supply the video as additional helper not as the main describer.
 
I can't edit the first post, I would ask you to add what I wrote to this post

My problem is that:
is player 'a' and player 'b'

player a attacks player b and player a gets a white skull
player b attacks the a player who has nailed a white skull on players b and player b after attacking the player a gets a yellow skulla

And I don't know if it's my fault that I added it in the wrong place or I have to edit the code to make it work properly
 
I don't get it, what's the problem? That is how it's supposed to work? You way of writing is also very messy, I have no idea if player a or player b is getting the yellow skull but in the video it seems player b which is how it should work?
 
His problem:
Player A attack Player B
Player B attack Player A for self defense
now Player B has a yellow skull and player A can kill him without getting a frag.
But yes, like @ZowN mentioned, i think this is how it supposed to work with allowFightBack = false, if you don't want this, just change it to allowFightBack = true?
 
Yea, that is how tibia works? What's the problem, is that NOT how you want it? Then you have to explain how you want it.
 
Back
Top