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

/highscore showing highscore frags as broadcast

jamil

.
Joined
Aug 11, 2008
Messages
79
Reaction score
2
I am trying to make a /highscore function used by admins/gm. The command is supposed to work as a broadcast message and display current highscore frags (and player if possible).

I have tried to make it myself, but it keeps giving me errors.
Moreover, I suck at the iterator functions, so I'm in real need of help :/

this is what I've done without success:
Code:
bool Commands::getFragHighscore(Creature* creature, const std::string& cmd, const std::string& param)
{
     Player* player = creature->getPlayer();
     Player* paramPlayer = g_game.getPlayerByName(param);
     
     int32_t maxFrags = 0;
     int32_t tmpPlayerFrags = 0;
     
     
     for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it)
     {
         [COLOR="Red"][B]tmpPlayerFrags = (*it)->paramPlayer->frags;[/B][/COLOR]
         if(tmpPlayerFrags > maxFrags)
             maxFrags = tmpPlayerFrags;
     }
     
     
     
     for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it)
         (*it).second->sendCreatureSay(paramPlayer, SPEAK_BROADCAST, maxFrags);
}


I have highlighted the area where the compiler shows error.

I would appreciate any kind of help.

Thanks..
 
You mean what the compiler showed... this was the error:

at tmpPlayerFrags = (*it)->paramPlayer->frags;
I got:

base operand of `->' has non-pointer type `std::pair<const uint32_t, Player*>'
 
Back
Top