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

C++ Show Damage K / KK

gabrielks1996

New Member
Joined
Feb 27, 2024
Messages
17
Reaction score
4
Good afternoon, could someone help me, I would like to show the damage and experiences summarized, example: instead of 1200 show 1.2k
both damage and experience

I use TFS 1.5
 
You will need to adjust for 1.5

Took me 3 seconds to find using the Search function :)
 
You will need to adjust for 1.5

Took me 3 seconds to find using the Search function :)

Friend, I think you didn't read it right, I use TFS 1.5. I've seen this topic, I would like someone to help me adapt it to tfs1.5
 
C++:
std::string formatDamageValue(uint value)
{
    std::stringstream ss;
    ss << std::fixed << std::setprecision(2);

    if (value >= std::pow(10, 12)) {
        ss << static_cast<double>(value) / std::pow(10, 12) << "T";
    } else if (value >= std::pow(10, 9)) {
        ss << static_cast<double>(value) / std::pow(10, 9) << "B";
    } else if (value >= std::pow(10, 6)) {
        ss << static_cast<double>(value) / std::pow(10, 6) << "M";
    } else if (value >= std::pow(10, 3)) {
        ss << static_cast<double>(value) / std::pow(10, 3) << "K";
    } else {
        ss << value;
    }

    return ss.str();
}

you can use this function in OTC source to format the values
 
Back
Top