Jump to content

Making player join channel without invite ?


Guest xeross155
 Share

Recommended Posts

Hey Folks,

I'm in the process of modifying mangchat (Will release a patch once done), 1 thing I dislike is everyone gets a prompt if they want tot join channel X if you enable the autojoin. I was wondering it it's possible to make people automatically join a channel without a prompt or anything.

Current code for making em join is.

void IRCClient::AutoJoinChannel(Player *plr)
{
   //this will work if at least 1 player is logged in regrdless if he is on the channel or not
   // the first person that login empty server is the one with bad luck and wont be invited, 
   // if at least 1 player is online the player will be inited to the chanel

   std::string m_name = sIRC.ajchan;
   WorldPacket data;
   data.Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1);
   data << uint8(CHAT_INVITE_NOTICE);
   data << m_name.c_str();

   HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
   for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
   {
       if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
       {
           data << uint64(itr->second->GetGUID());
           break;
       }
   }
   plr->GetSession()->SendPacket(&data);
}

Thanks for your time, Xeross

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use