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

Guild Public channel

ToloXXX

New Member
Joined
Dec 14, 2014
Messages
93
Reaction score
4
Anyone have a channel for just guild members where any guild member can talk thru,

if a player would talk would be like playername [guild] : msg

so "Tom [Pro Players]: Hello" if its possible guild leaders would be 1 color the rest an other color. \

Running 0.3.6 client 8.6 , Anyhelp would be great!
 
Update your ChatChannel::talk (chat.cpp), replace your code with this one:
C++:
bool ChatChannel::talk(Player* player, SpeakClasses type, const std::string& text, uint32_t _time/* = 0*/)
{
   UsersMap::iterator it = m_users.find(player->getID());
   if(it == m_users.end())
       return false;
 
   uint16_t channelId = getId();
   if(m_condition && !player->hasFlag(PlayerFlag_CannotBeMuted))
   {
       if(Condition* condition = m_condition->clone())
           player->addCondition(condition);
   }

   for(it = m_users.begin(); it != m_users.end(); ++it)
       it->second->sendToChannel(player, type, text, m_id, _time);

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open() && channelId = player->getGuildId())
       *m_file << "[" << formatDate() << "] " << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;
     
   if(channelId = player->getGuildId())
       *m_file << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open())
       *m_file << "[" << formatDate() << "] " << player->getName() << ": " << text << std::endl

   return true;
}
little below, you can set colour:
C++:
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_VICE:
                   return channel->talk(player, SPEAK_CHANNEL_O, text);
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
If you want colour only for LEADERS just remove option VICE, so it should looks like:
C++:
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
 
Last edited by a moderator:
I added it, testing it, but I dont see the chat.

Update your ChatChannel::talk (chat.cpp), replace your code with this one:
Code:
bool ChatChannel::talk(Player* player, SpeakClasses type, const std::string& text, uint32_t _time/* = 0*/)
{
   UsersMap::iterator it = m_users.find(player->getID());
   if(it == m_users.end())
       return false;
 
   uint16_t channelId = getId();
   if(m_condition && !player->hasFlag(PlayerFlag_CannotBeMuted))
   {
       if(Condition* condition = m_condition->clone())
           player->addCondition(condition);
   }

   for(it = m_users.begin(); it != m_users.end(); ++it)
       it->second->sendToChannel(player, type, text, m_id, _time);

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open() && channelId = player->getGuildId())
       *m_file << "[" << formatDate() << "] " << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;
     
   if(channelId = player->getGuildId())
       *m_file << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open())
       *m_file << "[" << formatDate() << "] " << player->getName() << ": " << text << std::endl

   return true;
}
little below, you can set colour:
Code:
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_VICE:
                   return channel->talk(player, SPEAK_CHANNEL_O, text);
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
If you want colour only for LEADERS just remove option VICE, so it should looks like:
Code:
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
 
._. I dont wanna change the original guild chat, the current one is suppose to be for members in the same guild, the one im asking is for PUBLIC view for all the guilds. So lets say im from one guild and you are from another, then we can both talk in the same chat. For just guilds

you should already have guild chat in ctrl+o, it's implemented by default..
 
Under this part in chat.cpp:
C++:
       if(channelId == CHANNEL_GUILD)
       {
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_VICE:
                   return channel->talk(player, SPEAK_CHANNEL_O, text);
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
       }
add this:
C++:
       if(channelId == 20)
       {
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
       }
Update your ChatChannel::talk (chat.cpp), replace your code with this one:
C++:
bool ChatChannel::talk(Player* player, SpeakClasses type, const std::string& text, uint32_t _time/* = 0*/)
{
   UsersMap::iterator it = m_users.find(player->getID());
   if(it == m_users.end())
       return false;
 
   uint16_t channelId = getId();
   if(m_condition && !player->hasFlag(PlayerFlag_CannotBeMuted))
   {
       if(Condition* condition = m_condition->clone())
           player->addCondition(condition);
   }

   for(it = m_users.begin(); it != m_users.end(); ++it)
       it->second->sendToChannel(player, type, text, m_id, _time);

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open() && channelId = 20)
       *m_file << "[" << formatDate() << "] " << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;
    
   if(channelId = 20)
       *m_file << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open())
       *m_file << "[" << formatDate() << "] " << player->getName() << ": " << text << std::endl

   return true;
}
in XML/channels.xml add:
XML:
<channel id="20" name="Guilds Chat" logged="yes" level="50"/>
 
Last edited by a moderator:
I would be grateful for tfs 1.2
Works only on 1-chatID
10:00 PlayerName [100][GuildName]: Text
Colours: leader=x; vice=y; others=z.

Thank you very much!
 

Attachments

So the chats there, but it doesnt show the players guild and it doesnt show any error


Under this part in chat.cpp:
C++:
       if(channelId == CHANNEL_GUILD)
       {
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_VICE:
                   return channel->talk(player, SPEAK_CHANNEL_O, text);
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
       }
add this:
C++:
       if(channelId == 20)
       {
           switch(player->getGuildLevel())
           {
               case GUILDLEVEL_LEADER:
                   return channel->talk(player, SPEAK_CHANNEL_RN, text);
               default:
                   break;
           }
       }
Update your ChatChannel::talk (chat.cpp), replace your code with this one:
C++:
bool ChatChannel::talk(Player* player, SpeakClasses type, const std::string& text, uint32_t _time/* = 0*/)
{
   UsersMap::iterator it = m_users.find(player->getID());
   if(it == m_users.end())
       return false;
 
   uint16_t channelId = getId();
   if(m_condition && !player->hasFlag(PlayerFlag_CannotBeMuted))
   {
       if(Condition* condition = m_condition->clone())
           player->addCondition(condition);
   }

   for(it = m_users.begin(); it != m_users.end(); ++it)
       it->second->sendToChannel(player, type, text, m_id, _time);

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open() && channelId = 20)
       *m_file << "[" << formatDate() << "] " << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;
   
   if(channelId = 20)
       *m_file << player->getName() << " [" << player->getGuildName() << "]: " << text << std::endl;

   if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open())
       *m_file << "[" << formatDate() << "] " << player->getName() << ": " << text << std::endl

   return true;
}
in XML/channels.xml add:
XML:
<channel id="20" name="Guilds Chat" logged="yes" level="50"/>
 
Back
Top