• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

C++ Check if a kill is unjustified

Joined
Apr 15, 2014
Messages
75
Reaction score
18
Hello I need to know how to check wether a kill was justified or not in the callback onKill. Could someone help?
 
You could try something like this, then see if anything changes.

Code:
uint32_t flags = 0;
        if(entry.isLast() && entry.isJustify()) {
            flags |= 1, 2;
        }
       
        if(entry.isLast() && entry.isUnjustified()) {
            flags |= 1, 4;
        }
 
7 years later, but i've a 0.4 server and had this same issue XD

at bool Player::onKilledCreature(Creature* target, DeathEntry& entry)

this code:
if (!Creature::onKilledCreature(target, entry))
return false;

that triggers the creatureEvent function, was called before the entry was setted to unjustified. So you just move it near to the end of the function, before:

if(entry.isUnjustified())

Greetings!
 
7 years later, but i've a 0.4 server and had this same issue XD

at bool Player::onKilledCreature(Creature* target, DeathEntry& entry)

this code:
if (!Creature::onKilledCreature(target, entry))
return false;

that triggers the creatureEvent function, was called before the entry was setted to unjustified. So you just move it near to the end of the function, before:

if(entry.isUnjustified())

Greetings!
Did you try the suggestion above your question? And if so what was the output?
If i remember correctly this was a major flaw in old TFS, I highly suggest trying to upgrade to at least 1.2~ or higher.
 
yes sure, it worked perfectly for me, i'm making an advanced achievement system and one of them is to kill players unjustifiably, so i made it in lua using an onKill creatureEvent c:
Greetings
 
Back
Top