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

[Command] Mc checking

slaw

Software Developer
Joined
Aug 27, 2007
Messages
3,665
Solutions
125
Reaction score
1,111
Location
Germany
GitHub
slawkens
I'm trying add commands mc check, but there is compiling error which i cant fix.

Here code:
Code:
bool Commands::mcCheck(Creature* creature, const std::string& cmd, const std::string& param)
{
    std::stringstream info;
    unsigned char ip[4];
        
    if(Player* player = creature->getPlayer()){   
        info << "The following players are multiclienting: \n";
        info << "Name          IP" << "\n";
        for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it){
            Player* lol = (*it).second;                                                   
            for(AutoList<Player>::listiterator cit = Player::listPlayer.list.begin(); cit != Player::listPlayer.list.end(); ++cit){
                if((*cit).second != lol && (*cit).second->lastip == lol->lastip){
                *(unsigned long*)&ip = (*cit).second->lastip;
                    info << (*cit).second->getName() << "      " << (unsigned int)ip[0] << "." << (unsigned int)ip[1] << 
        "." << (unsigned int)ip[2] << "." << (unsigned int)ip[3] << "\n";       
                }                                                           
            }
        }      
        player->sendTextMessage(MSG_STATUS_CONSOLE_RED, info.str().c_str());        
    }
    else{
        return false;
    }
       
    return true;                                     
}

Compiling errors:
Code:
commands.cpp: In member function `bool Commands::mcCheck(Creature*, const std::string&, const std::string&)':
commands.cpp:1362: error: 'class Player' has no member named 'lastip'
commands.cpp:1362: error: 'class Player' has no member named 'lastip'
commands.cpp:1363: error: 'class Player' has no member named 'lastip'

Help :(
 
Code:
bool Commands::showMultiClients(Creature* creature, const std::string& cmd, const std::string& param)
{
    std::stringstream info;
    uint8_t ip[4];
        
    if(Player* player = creature->getPlayer())
	{   
        info << "The following players are multiclienting: \n";
        info << "Name          IP" << "\n";
        for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it)
		{
            Player* lol = (*it).second;                                                   
            for(AutoList<Player>::listiterator cit = Player::listPlayer.list.begin(); cit != Player::listPlayer.list.end(); ++cit)
			{
                if((*cit).second != lol && (*cit).second->lastIP == lol->lastIP)
				{
				*(uint32_t*)&ip = (*cit).second->lastIP;
                    info << (*cit).second->getName() << "      " << ipText(ip) << "\n";       
                }                                                           
            }
        }      
        player->sendTextMessage(MSG_STATUS_CONSOLE_RED, info.str().c_str());        
    }
    else
	{
        return false;
    }
       
    return true;                                     
}
Try.
 
Back
Top