gabrielks1996
New Member
- Joined
- Feb 27, 2024
- Messages
- 17
- Reaction score
- 4
I modified ProtocolGame::AddCreature to show my storage which is the number of resets next to the player name. But when a person goes to add VIP or send a message it says that the player does not exist because it changes the person's name too. Any solution?
TFS 1.5
TFS 1.5
Lua:
const Player* otherPlayer = creature->getPlayer();
if (known) {
msg.add<uint16_t>(0x62);
msg.add<uint32_t>(creature->getID());
} else {
msg.add<uint16_t>(0x61);
msg.add<uint32_t>(remove);
msg.add<uint32_t>(creature->getID());
if (const Player* player = dynamic_cast<const Player*>(creature)) {
int storageValue;
if (player->getStorageValue(500, storageValue)) {
std::string storageString = "[" + std::to_string(storageValue) + "]";
std::stringstream ss;
ss << player->getName() << " " << storageString;
msg.addString(ss.str());
} else {
std::string storageString = "[0]";
std::stringstream ss;
ss << player->getName() << " " << storageString;
msg.addString(ss.str());
}
} else {
msg.addString(creature->getName());
}
}
Last edited: