hy guys i have this codigo what, makes life is mana stay for %
on my 8.6 server it works perfectly
the player's life is only in % when the player reaches life 65535 the same thing for mana i wanted to make this change in tfs 1.4 my server version is 12.70
I already got for life and mana for % with this code below but I wanted to modify the same serial code above as possible?
if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH)) > 65535 {
if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
{
msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
msg->put<uint16_t>(100);
}
else
{
msg->put<uint16_t>(0);
msg->put<uint16_t>(0);
}
} else {
msg->put<uint16_t>(player->getHealth());
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
}
on my 8.6 server it works perfectly
the player's life is only in % when the player reaches life 65535 the same thing for mana i wanted to make this change in tfs 1.4 my server version is 12.70
I already got for life and mana for % with this code below but I wanted to modify the same serial code above as possible?
C++:if (player->getMaxHealth() > 0) { msg.add<uint16_t>(std::min<int32_t>(player->getHealth() * 100 / player->getMaxHealth(), std::numeric_limits<uint16_t>::max())); msg.add<uint16_t>(100); } else { msg.add<uint16_t>(0); msg.add<uint16_t>(0); }