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

Compiling solved

Truwzka

Member
Joined
Nov 26, 2009
Messages
408
Reaction score
19
Location
Brazilia/Brazil
Hello, I want to change it:
Code:
if((channel = g_chat.getChannel(list[0].getKillerCreature()->getPlayer(), CHANNEL_GUILD)))
to appear on default channel. I tried change to 'CHANNEL_DEFAULT' but doesnt work.
Someone help me ?
 
Remove the check for channel and use:
g_game.broadcastMessage(s.str().c_str(), MSG_EVENT_ADVANCE);
 
Code:
g_game.broadcastMessage(list[0].getKillerCreature()->getPlayer(),MSG_EVENT_ADVANCE);
Any syntax error? or all right?

- - - Updated - - -

Code:
  In member function 'void IOGuild::frag(Player*, uint64_t, const DeathList&, bool)': 
547 C:\Users\Renan\Desktop\soucers 0.4.0\ioguild.cpp no matching function for call to 'Game::broadcastMessage(Player*, MessageClasses)' 
 note C:\Users\Renan\Desktop\soucers 0.4.0\game.h:524 candidates are: bool Game::broadcastMessage(const std::string&, MessageClasses) 
558 C:\Users\Renan\Desktop\soucers 0.4.0\ioguild.cpp no matching function for call to 'Game::broadcastMessage(Player*, MessageClasses)' 
 note C:\Users\Renan\Desktop\soucers 0.4.0\game.h:524 candidates are: bool Game::broadcastMessage(const std::string&, MessageClasses) 
 note C:\Users\Renan\Desktop\soucers 0.4.0\game.h:524 *** [obj//ioguild.o] Error 1
 
First parameter of the broadcast function is the message / text, there is no player needed.
It will just popup in the middle of the screen like a normal broadcast.

Replace the channel->talk with the broadcast stuff.
 
Last edited:
I'm lost: x
this is the complete code if you can help me
Code:
ChatChannel* channel = NULL;
	if((channel = g_chat.getChannel(player, CHANNEL_DEFAULT)))
	{
		s << "Guild member " << player->getName() << " was killed by " << killers << ".";
		if(score)
			s << " The new score is " << war.frags[war.type == WAR_GUILD] << ":"
				<< war.frags[war.type] << " frags (limit " << war.limit << ").";

		channel->talk("", SPEAK_CHANNEL_RA, s.str());
	}

	s.str("");
	if((channel = g_chat.getChannel(list[0].getKillerCreature()->getPlayer(), CHANNEL_DEFAULT)))
	{
		s << "Opponent " << player->getName() << " was killed by " << killers << ".";
		if(score)
			s << " The new score is " << war.frags[war.type] << ":"
				<< war.frags[war.type == WAR_GUILD] << " frags (limit " << war.limit << ").";

		channel->talk("", SPEAK_CHANNEL_RA, s.str());
	}

	Database* db = Database::getInstance();
	DBQuery query;

	query << "INSERT INTO `guild_kills` (`guild_id`, `war_id`, `death_id`) VALUES ("
		<< war.ids[war.type] << ", " << war.war << ", " << deathId << ");";
	db->query(query.str());
}
#endif
 
This?
[cpp]ChatChannel* channel = NULL;

s << "Guild member " << player->getName() << " was killed by " << killers << ".";
if(score)
s << " The new score is " << war.frags[war.type == WAR_GUILD] << ":"
<< war.frags[war.type] << " frags (limit " << war.limit << ").";

//channel->talk("", SPEAK_CHANNEL_RA, s.str());
g_game.broadcastMessage(s.str().c_str(), MSG_EVENT_ADVANCE);

s.str("");

s << "Opponent " << player->getName() << " was killed by " << killers << ".";
if(score)
s << " The new score is " << war.frags[war.type] << ":"
<< war.frags[war.type == WAR_GUILD] << " frags (limit " << war.limit << ").";

//channel->talk("", SPEAK_CHANNEL_RA, s.str());
g_game.broadcastMessage(s.str().c_str(), MSG_EVENT_ADVANCE);

Database* db = Database::getInstance();
DBQuery query;

query << "INSERT INTO `guild_kills` (`guild_id`, `war_id`, `death_id`) VALUES ("
<< war.ids[war.type] << ", " << war.war << ", " << deathId << ");";
db->query(query.str());
}[/cpp]
 
I'll compile and test,
anyway i love you <3

I've test.
worked, messages appear on deafault, but the two messages appeared to the whole server
eg:
Code:
21:06 Guild member Tee Kin was killed by Fire Elemental. The new score is 0:2 frags (limit 285).
21:06 Opponent Tee Kin was killed by Fire Elemental. The new score is 2:0 frags (limit 285).

The messages should be restricted to members of the guilds, you understand me?
 
Last edited:
[cpp] std::stringstream sAlly, sOpponent;
sAlly << "Guild member " << player->getName() << " was killed by " << killers << ".";
if(score)
sAlly << " The new score is " << war.frags[war.type == WAR_GUILD] << ":"
<< war.frags[war.type] << " frags (limit " << war.limit << ").";

sOpponent << "Opponent " << player->getName() << " was killed by " << killers << ".";
if(score)
sOpponent << " The new score is " << war.frags[war.type] << ":"
<< war.frags[war.type == WAR_GUILD] << " frags (limit " << war.limit << ").";

uint32_t victimGuildId = player->getGuildId();
for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
{
uint32_t guildId = it->second->getGuildId();
if(guildId != war.ids[WAR_GUILD] && guildId != war.ids[WAR_ENEMY])
continue;

if(guildId && guildId == victimGuildId)
it->second->sendTextMessage(MSG_EVENT_ADVANCE, sAlly.str().c_str());
else if(guildId && guildId != victimGuildId)
it->second->sendTextMessage(MSG_EVENT_ADVANCE, sOpponent.str().c_str());
}[/cpp]
 
Last edited:
I put so:
Code:
ChatChannel* channel = NULL;
 
	std::stringstream sAlly, sOpponent;
	sAlly << "Guild member " << player->getName() << " was killed by " << killers << ".";
	if(score)
		sAlly << " The new score is " << war.frags[war.type == WAR_GUILD] << ":"
			<< war.frags[war.type] << " frags (limit " << war.limit << ").";
 
	sOpponent << "Opponent " << player->getName() << " was killed by " << killers << ".";
	if(score)
		sOpponent << " The new score is " << war.frags[war.type] << ":"
			<< war.frags[war.type == WAR_GUILD] << " frags (limit " << war.limit << ").";
 
	uint32_t victimGuildId = player->getGuildId();
	for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
	{
		uint32_t guildId = it->second->getGuildId();
		if(guildId != war.ids[WAR_GUILD] && guildId != war.ids[WAR_ENEMY])
			continue;
 
		if(guildId && guildId == victimGuildId) 
			it->second->sendTextMessage(MSG_EVENT_ADVANCE, sAlly.str().c_str());
		else if(guildId && guildId != victimGuildId)
			it->second->sendTextMessage(MSG_EVENT_ADVANCE, sOpponent.str().c_str());
	}
 
	Database* db = Database::getInstance();
	DBQuery query;
 
	query << "INSERT INTO `guild_kills` (`guild_id`, `war_id`, `death_id`) VALUES ("
		<< war.ids[war.type] << ", " << war.war << ", " << deathId << ");";
	db->query(query.str());
}
#endif

and appeared:
Code:
  In member function 'void IOGuild::frag(Player*, uint64_t, const DeathList&, bool)': 
560 C:\Users\Renan\Desktop\soucers 0.4.0\ioguild.cpp 'i' was not declared in this scope 
560 C:\Users\Renan\Desktop\soucers 0.4.0\ioguild.cpp *** [obj//ioguild.o] Error 1
 
Last edited by a moderator:
all ok! VERY thanks!
if I want to add the name of the guild before 'was killed', should I put it?
Code:
 sOpponent << "Opponent " << player->getName() << "from" << player->getGuild() << " was killed by " << killers << ".";

and if I need to show the messages simultaneously (in the server log and guildchat) I just put the old code with the new, or is there something else to be done?
 
Last edited:
Just paste:
[cpp]ChatChannel* channel = NULL;
if((channel = g_chat.getChannel(player, CHANNEL_DEFAULT)))
{
s << "Guild member " << player->getName() << " was killed by " << killers << ".";
if(score)
s << " The new score is " << war.frags[war.type == WAR_GUILD] << ":"
<< war.frags[war.type] << " frags (limit " << war.limit << ").";

channel->talk("", SPEAK_CHANNEL_RA, s.str());
}

s.str("");
if((channel = g_chat.getChannel(list[0].getKillerCreature()->getPlayer(), CHANNEL_DEFAULT)))
{
s << "Opponent " << player->getName() << " was killed by " << killers << ".";
if(score)
s << " The new score is " << war.frags[war.type] << ":"
<< war.frags[war.type == WAR_GUILD] << " frags (limit " << war.limit << ").";

channel->talk("", SPEAK_CHANNEL_RA, s.str());
}[/cpp]

After my code.

- - - Updated - - -

Replace: MSG_EVENT_ADVANCE
With: MSG_INFO_DESCR
 
Back
Top