• 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++] Need someone to check this code!

Gaddhuve

Member
Joined
May 6, 2011
Messages
76
Solutions
1
Reaction score
19
Im learning C++ so I thought it would be a good idea to try edit some TFS sources.

This is the code Im using

Player.cpp
PHP:
std::string Player::getRanger(uint32_t level) const
{
        std::string rang = "Rank 1";
        if(level >= 40 && level <= 45)
        {
            rang = "Rank 2";
        }
        else if(level > 45 && level <= 60)
        {
            rang = "Rank 3";
        }
        else if(level > 60 && level <= 75)
        {
            rang = "Rank 4";
        }
        else if(level > 75 && level <= 90)
        {
            rang = "Rank 5";
        }
        else if(level > 90 && level <= 105)
        {
            rang = "Rank 6";
        }
        else if(level > 105 && level <= 120)
        {
            rang = "Rank 7";
        }
        else if(level > 120 && level <= 135)
        {
            rang = "Rank 8";
        }
        else if(level > 135)
        {
            rang = "Rank 9";
        } 
        return rang;

And bit lower down:

player.cpp
PHP:
	if(lookDistance == -1)
	{
		s << " you have the rank ";
  std::string rang = Player::getRanger(level);
            s << rang << ".";
    }           
		else
		{
        s << ". " << (sex == PLAYERSEX_FEMALE ? "She" : "He");
            s << " has the rank ";
            std::string rang = Player::getRanger(level);
            s << rang << ".";
            }

And ofc in

player.h
PHP:
		virtual std::string getRanger(uint32_t level) const;

Its suppose to divide the players in diffrent 'ranks' depending on what level they are. It compiles without any errors but it does now show me what I want.

Thnx in advance
Gaddhuve
 
well, what does it show instead?
if you made these changes/added this in the proper place, there can't be 0 change ingame
 
Back
Top