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

[Bug Report] CannotAttackPlayer flag is bugged

Demnish

Tibian Hero
Joined
Sep 28, 2011
Messages
402
Solutions
2
Reaction score
65
Location
Sweden
Changed some flags for my GM character and while I can attack monsters, I can not attack players.
Character has Group 3 and account is Type 5.

groups.xml
XML:
<group id="3" name="god" access="1" maxdepotitems="0" maxvipentries="200" >
        <flags>
            <flag cannotusecombat="0" />
            <flag cannotattackplayer="0" /> -- Not Working
            <flag cannotattackmonster="0" />
            <flag cannotbeattacked="1" />
            <flag canconvinceall="1" />
            <flag cansummonall="1" />
            <flag canillusionall="1" />
            <flag cansenseinvisibility="1" />
            <flag ignoredbymonsters="1" />
            <flag notgaininfight="1" />
            <flag hasinfinitemana="1" />
            <flag hasinfinitesoul="1" />
            <flag hasnoexhaustion="1" />
            <flag canalwayslogin="1" />
            <flag cannotbepushed="1" />
            <flag hasinfinitecapacity="1" />
            <flag cannotpushallcreatures="0" />
            <flag cantalkredprivate="1" />
            <flag cantalkredchannel="1" />
            <flag talkorangehelpchannel="1" />
            <flag notgainexperience="1" />
            <flag notgainmana="1" />
            <flag notgainhealth="1" />
            <flag notgainskill="1" />
            <flag setmaxspeed="1" />
            <flag specialvip="1" />
            <flag notgenerateloot="0" />
            <flag cantalkredchannelanonymous="1" />
            <flag ignoreprotectionzone="1" />
            <flag ignorespellcheck="1" />
            <flag ignoreweaponcheck="1" />
            <flag cannotbemuted="1" />
            <flag isalwayspremium="1" />
        </flags>
    </group>
gmcantattack.png
 

Attachments

I already explained this "issue" here xD, not a bug (even the issue reporter closed the issue 😁 ):

2020-02-22 19_27_03-Data_XML_Groups.xml_Flags dont work · Issue #2790 · otland_forgottenserver.png
 
Last edited by a moderator:
So why shouldn't all 3 of the options be 0 as I currently have?
Lua:
<flag cannotusecombat="0" /> -- 0 = You can use combat
<flag cannotattackplayer="0" /> -- 0 = You can attack players
<flag cannotattackmonster="0" /> -- 0 = You can attack monsters
At least that is how I interpret them and I can't be the only one doing so.

Because judging by the flags I have enabled all types of combat for the character.
Since they're all false due to being bools.

And at least two of them works, namely cannotusecombat & cannotattackmonster since I can attack monsters.
 
Last edited:
So why shouldn't all 3 of the options be 0 as I currently have?
Lua:
<flag cannotusecombat="0" /> -- 0 = You can use combat
<flag cannotattackplayer="0" /> -- 0 = You can attack players
<flag cannotattackmonster="0" /> -- 0 = You can attack monsters
At least that is how I interpret them and I can't be the only one doing so.

Because judging by the flags I have enabled all types of combat for the character.
Since they're all false due to being bools.

And at least two of them works, namely cannotusecombat & cannotattackmonster since I can attack monsters.
account type should be 6 and player group 3, i have 0 on these 3 flags and I'm able to attack both players and monsters, so there is no bug as I said
 
Then the real problem was that I was using Type 5 in account, not my flags.
Thanks.

Is there somewhere one can get information on account Types? Since we only have groups.xml and no .txt file about accounts and their access.


Account Type 6 with all 3 flags as 0/false doesn't work either.
So it's still a bug.

I haven't even messed in those parts of the sources and I'm using the latest master from git hub.

EDIT: Max account type is Type 5 btw which = ACCOUNT_TYPE_GOD in the sources.
 

Attachments

Last edited:
2020-02-22 23_32_34-Tibia - Perflex.png2020-02-22 23_33_39-localhost _ Uniform Server _ sadteam _ accounts _ phpMyAdmin 4.9.0.1.png
2020-02-22 23_35_06-localhost _ Uniform Server _ sadteam _ players _ phpMyAdmin 4.9.0.1.png2020-02-22 23_36_11-C__Users_Iuri_Desktop_bamboosha_forgottenserver-master_data_XML_groups.xml...png

I can attack both fine as seen on first picture, but my tfs have several mods (but none related to this), so I think we need a third person to try this xd

ps: it my sound dumb, but it worth to ask if the character you are attacking is not a "cannontbeattacked="1"" flagged one?
 
Solved, by editing the sources.

combat.cpp
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->getVocationId() == VOCATION_NONE || target->getVocationId() == VOCATION_NONE) {
        //return true;
    //}

    if (attacker->getSkull() == SKULL_BLACK && attacker->getSkullClient(target) == SKULL_NONE) {
        return true;
    }

    return false;
}
A remnant of the past which should've never existed so I commented it out.
You can add non-pvp tiles with RME which makes rookgaard a non-pvp zone.
What if you want to have pvp in rookgaard? This makes that impossible.
Do I even have to mention the problem it caused me trying to figure out why the group flags didn't work?

Remove this from the sources for future releases, the only reason for it to exist is for people who don't know how to use RME.

Besides, we now also have protectionLevel which can be used. 😒
 
so there were no bug, you were just trying to attack a non vocation character? 🤣
 
No, my GM is a No Vocation character.

So I'd call that a bug 100% though.
Whoever can, please remove that piece of 💩 code. 🤣

Shouldn't even be in there with all the other options we have, it's redundant.
It's so old that I found a thread from 2015 with a dude having this problem.
It have outlived its usefulness for over 5 years, time to bury it.
 
Last edited:
Back
Top