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

Server log shows how much other player hits (remove)

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
873
Solutions
2
Reaction score
49
Hi, by default tfs 1.2 have this function if you stand to next player you can see his dmg in server-log which makes no sense because it should only show yours not someone else who stands next to you and deals so dmg to monster. Im not talking about when he hits you.
 
You can disable it in your client options if you don't want to see it. It's located in the console section.
 
Hi, by default tfs 1.2 have this function if you stand to next player you can see his dmg in server-log which makes no sense because it should only show yours not someone else who stands next to you and deals so dmg to monster. Im not talking about when he hits you.
need it too...
You can disable it in your client options if you don't want to see it. It's located in the console section.
i think if u disable in console, u disable damage that u got too
 
C++:
tmpPlayer->sendTextMessage(message);
to
C++:
if (message.text != spectatorMessage)
    tmpPlayer->sendTextMessage(message);
in:

It should work but it's a pretty ugly solution. If you want to get this right you shouldn't even create the spectatorMessage if you aren't going to use it and also move the "sendTextMessage" function inside the if statements that you interested in being displayed in the server log.
 
Just look for this in game.cpp & either comment it out.
C++:
ss << " due to an attack by " << attacker->getNameDescription() << '.';
Or add a if statement if the attacker is a monster to execute the code. I am not at a pc so i can't do it for you
 
C++:
tmpPlayer->sendTextMessage(message);
to
C++:
if (message.text != spectatorMessage)
    tmpPlayer->sendTextMessage(message);
in:

It should work but it's a pretty ugly solution. If you want to get this right you shouldn't even create the spectatorMessage if you aren't going to use it and also move the "sendTextMessage" function inside the if statements that you interested in being displayed in the server log.
Im not going to use spectatorMessage
Just look for this in game.cpp & either comment it out.
C++:
ss << " due to an attack by " << attacker->getNameDescription() << '.';
Or add a if statement if the attacker is a monster to execute the code. I am not at a pc so i can't do it for you
Isnt it going to delete message when you hit each other?
 
Have you even tried it? You are currently using spectatorMessage though... it has nothing to do with spectator system(cam).
 
C++:
tmpPlayer->sendTextMessage(message);
to
C++:
if (message.text != spectatorMessage)
    tmpPlayer->sendTextMessage(message);
in:

It should work but it's a pretty ugly solution. If you want to get this right you shouldn't even create the spectatorMessage if you aren't going to use it and also move the "sendTextMessage" function inside the if statements that you interested in being displayed in the server log.
Tried your way it doesnt removed text and i have no idea how it even should remove.
Just look for this in game.cpp & either comment it out.
C++:
ss << " due to an attack by " << attacker->getNameDescription() << '.';
Or add a if statement if the attacker is a monster to execute the code. I am not at a pc so i can't do it for you
Code like this doesnt exist in game.cpp

To make it clear need to remove this stuff \/
A Bag loses 8 hitpoints due to an attack by Test.
 
Tried your way it doesnt removed text and i have no idea how it even should remove.

Before sending the message you compare the body of message to spectatorMessage, if it matches you just don't send the the "X loses hitpoints duo to an attack by X." msg to the all so called spectators (third party people in nearby area). Also just checked it on one of my builds and it worked just fine. Didn't you miss anything? You can paste the code after editing.
 
Before sending the message you compare the body of message to spectatorMessage, if it matches you just don't send the the "X loses hitpoints duo to an attack by X." msg to the all so called spectators (third party people in nearby area). Also just checked it on one of my builds and it worked just fine. Didn't you miss anything? You can paste the code after editing.
Yea im pretty sure i did everything fine
C++:
            spectatorMessage += '.';
 
            for (Creature* spectator : list) {
                Player* tmpPlayer = spectator->getPlayer();
                if (tmpPlayer->getPosition().z != targetPos.z) {
                    continue;
                }
 
                if (tmpPlayer == attackerPlayer && attackerPlayer != targetPlayer) {
                    message.type = MESSAGE_STATUS_DEFAULT;
                    message.text = ucfirst(target->getNameDescription()) + " loses " + damageString + " due to your attack.";
                } else if (tmpPlayer == targetPlayer) {
                    message.type = MESSAGE_STATUS_DEFAULT;
                    if (!attacker) {
                        message.text = "You lose " + damageString + '.';
                    } else if (targetPlayer == attackerPlayer) {
                        message.text = "You lose " + damageString + " due to your own attack.";
                    } else {
                        message.text = "You lose " + damageString + " due to an attack by " + attacker->getNameDescription() + '.';
                    }
                } else {
                    message.type = MESSAGE_STATUS_DEFAULT;
                    // TODO: Avoid copying spectatorMessage everytime we send to a spectator
                    message.text = spectatorMessage;
                }             
                if (message.text != spectatorMessage)
                tmpPlayer->sendTextMessage(message);
            }
        }
    }
 
    return true;
}
 
C++:
tmpPlayer->sendTextMessage(message);
C++:
//tmpPlayer->sendTextMessage(message);
Try commenting this one out and see if it stops sending dmg related messages in the server log for everyone if it doesn't then try checking if you launch the right exe file or if you edit the right game.cpp file.

If it for some reason worked then try changing the whole thing to this(even tho the first solution should work just fine):
C++:
for (Creature* spectator : list) {
    Player* tmpPlayer = spectator->getPlayer();
    if (tmpPlayer->getPosition().z != targetPos.z) {
        continue;
    }

    if (tmpPlayer == attackerPlayer && attackerPlayer != targetPlayer) {
        message.type = MESSAGE_STATUS_DEFAULT;
        message.text = ucfirst(target->getNameDescription()) + " loses " + damageString + " due to your attack.";
        tmpPlayer->sendTextMessage(message);
    } else if (tmpPlayer == targetPlayer) {
        message.type = MESSAGE_STATUS_DEFAULT;
        if (!attacker) {
            message.text = "You lose " + damageString + '.';
        } else if (targetPlayer == attackerPlayer) {
            message.text = "You lose " + damageString + " due to your own attack.";
        } else {
            message.text = "You lose " + damageString + " due to an attack by " + attacker->getNameDescription() + '.';
        }
        tmpPlayer->sendTextMessage(message);
    } else {
        message.type = MESSAGE_STATUS_DEFAULT;
        // TODO: Avoid copying spectatorMessage everytime we send to a spectator
        message.text = spectatorMessage;
    }             
}
 
C++:
tmpPlayer->sendTextMessage(message);
C++:
//tmpPlayer->sendTextMessage(message);
Try commenting this one out and see if it stops sending dmg related messages in the server log for everyone if it doesn't then try checking if you launch the right exe file or if you edit the right game.cpp file.

If it for some reason worked then try changing the whole thing to this(even tho the first solution should work just fine):
C++:
for (Creature* spectator : list) {
    Player* tmpPlayer = spectator->getPlayer();
    if (tmpPlayer->getPosition().z != targetPos.z) {
        continue;
    }

    if (tmpPlayer == attackerPlayer && attackerPlayer != targetPlayer) {
        message.type = MESSAGE_STATUS_DEFAULT;
        message.text = ucfirst(target->getNameDescription()) + " loses " + damageString + " due to your attack.";
        tmpPlayer->sendTextMessage(message);
    } else if (tmpPlayer == targetPlayer) {
        message.type = MESSAGE_STATUS_DEFAULT;
        if (!attacker) {
            message.text = "You lose " + damageString + '.';
        } else if (targetPlayer == attackerPlayer) {
            message.text = "You lose " + damageString + " due to your own attack.";
        } else {
            message.text = "You lose " + damageString + " due to an attack by " + attacker->getNameDescription() + '.';
        }
        tmpPlayer->sendTextMessage(message);
    } else {
        message.type = MESSAGE_STATUS_DEFAULT;
        // TODO: Avoid copying spectatorMessage everytime we send to a spectator
        message.text = spectatorMessage;
    }            
}
It removed message from server-log completely so its not what i asked because now the person who hits creature cant see his own dmg the whole point was to delete the message when you stand close too him and see his dmg in server-log. Message example is
A Bag loses 8 hitpoints due to an attack by Test.
 

Find and delete:

C++:
        if (message.primary.color != TEXTCOLOR_NONE || message.secondary.color != TEXTCOLOR_NONE) {
            std::string damageString = std::to_string(realDamage) + (realDamage != 1 ? " hitpoints" : " hitpoint");
            std::string spectatorMessage = ucfirst(target->getNameDescription()) + " loses " + damageString;
            if (attacker) {
                spectatorMessage += " due to ";
                if (attacker == target) {
                    spectatorMessage += (targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her own attack" : "his own attack") : "its own attack");
                } else {
                    spectatorMessage += "an attack by " + attacker->getNameDescription();
                }
            }
            spectatorMessage += '.';
 
Find and delete:

C++:
        if (message.primary.color != TEXTCOLOR_NONE || message.secondary.color != TEXTCOLOR_NONE) {
            std::string damageString = std::to_string(realDamage) + (realDamage != 1 ? " hitpoints" : " hitpoint");
            std::string spectatorMessage = ucfirst(target->getNameDescription()) + " loses " + damageString;
            if (attacker) {
                spectatorMessage += " due to ";
                if (attacker == target) {
                    spectatorMessage += (targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her own attack" : "his own attack") : "its own attack");
                } else {
                    spectatorMessage += "an attack by " + attacker->getNameDescription();
                }
            }
            spectatorMessage += '.';
Look like kinda harsh move, but w/e. I got
1>..\src\game.cpp(3923): error C2065: 'damageString': undeclared identifier
1>..\src\game.cpp(3927): error C2065: 'damageString': undeclared identifier
1>..\src\game.cpp(3929): error C2065: 'damageString': undeclared identifier
1>..\src\game.cpp(3931): error C2065: 'damageString': undeclared identifier
1>..\src\game.cpp(3936): error C2065: 'spectatorMessage': undeclared identifier
1>..\src\game.cpp(3943): error C2059: syntax error: 'return'
1>..\src\game.cpp(3944): error C2059: syntax error: '}'
1>..\src\game.cpp(3944): error C2143: syntax error: missing ';' before '}'
1>..\src\game.cpp(3947): error C2143: syntax error: missing ';' before '{'
1>..\src\game.cpp(3947): error C2447: '{': missing function header (old-style formal list?)
 
Back
Top