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

!createguild always crashes.

DedicatedOT

New Member
Joined
Jun 13, 2009
Messages
977
Reaction score
4
Location
USA
This is a dump of my guild sql:
Code:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

CREATE TABLE IF NOT EXISTS `guilds` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL COMMENT 'guild name - nothing else needed here',
  `ownerid` int(11) NOT NULL,
  `creationdata` int(11) NOT NULL,
  `motd` varchar(255) NOT NULL,
  `logo_gfx_name` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `guilds`
--

INSERT INTO `guilds` (`id`, `name`, `ownerid`, `creationdata`, `motd`, `logo_gfx_name`) VALUES
(1, 'Test', 2, 1245621281, 'Your guild has successfully been created, to view all available commands use: <!commands>. If you would like to remove this message use <!cleanmotd>, if you would like to edit it, use <!setmotd newMotd>.', ''),
(2, 'Elementals', 14, 1245628487, 'Your guild has successfully been created, to view all available commands use: <!commands>. If you would like to remove this message use <!cleanmotd>, if you would like to edit it, use <!setmotd newMotd>.', ''),
(3, 'Hello', 2, 1245640873, 'Your guild has successfully been created, to view all available commands use: <!commands>. If you would like to remove this message use <!cleanmotd>, if you would like to edit it, use <!setmotd newMotd>.', '');

How come whenever anybody execute the !createguild function, the server crashes?

Im running TFS 0.2.3 Mystic Spirit.

Here is the createguild function
Code:
bool IOGuild::createGuild(Player* player)
{
	Database* db = Database::getInstance();
	if(!db->connect())
		return false;

	DBQuery query;
	DBResult result;

	query << "INSERT INTO `guilds` ( `id` , `name` , `ownerid` , `creationdata` , `motd` ) VALUES (NULL , '" << Database::escapeString(player->getGuildName()) << "', '" << player->getGUID() << "', '" << time(NULL) << "', 'Your guild has successfully been created, to view all available commands use: <!commands>. If you would like to remove this message use <!cleanmotd>, if you would like to edit it, use <!setmotd newMotd>.');";
	if(!db->executeQuery(query))
		return false;

	query << "SELECT `id` FROM `guilds` WHERE `ownerid` = " << player->getGUID();
	if(!db->storeQuery(query, result))
		return false;

	player->setGuildId(result.getDataInt("id"));
	player->setGuildLevel(GUILDLEVEL_LEADER);
	return true;
}
ioguild.cpp


I will seriously pay you if you help me with a solution. It simply crashes. It doesn't have an error read out that I can see...

Please help. I got this problem ever since I attempted to install Gresior's Account AC, which added a column of "logo_gfx_name," -- I later deleted that column.
 
INSERT INTO `guilds` (`id`, `name`, `ownerid`, `creationdata`, `motd`, `logo_gfx_name`)

This table still exists, but it shouldn`t crash your server anyway.
 
INSERT INTO `guilds` (`id`, `name`, `ownerid`, `creationdata`, `motd`, `logo_gfx_name`)

This table still exists, but it shouldn`t crash your server anyway.


If I leave the logo_gfx_name there, it just says
Code:
logo_gfx_name does not have a default value...
 
Try changing your code to this:

Code:
bool IOGuild::createGuild(Player* player)
{
	Database* db = Database::getInstance();
	if(!db->connect())
		return false;

	DBQuery query;
	DBResult result;

	query << "INSERT INTO `guilds` ( `id` , `name` , `ownerid` , `creationdata` , `motd`, `logo_gfx_name` ) VALUES (NULL , '" << Database::escapeString(player->getGuildName()) << "', '" << player->getGUID() << "', '" << time(NULL) << "', 'Your guild has successfully been created, to view all available commands use: <!commands>. If you would like to remove this message use <!cleanmotd>, if you would like to edit it, use <!setmotd newMotd>.', NULL);";
	if(!db->executeQuery(query))
		return false;

	query << "SELECT `id` FROM `guilds` WHERE `ownerid` = " << player->getGUID();
	if(!db->storeQuery(query, result))
		return false;

	player->setGuildId(result.getDataInt("id"));
	player->setGuildLevel(GUILDLEVEL_LEADER);
}
 
Try changing your code to this:

Code:
bool IOGuild::createGuild(Player* player)
{
	Database* db = Database::getInstance();
	if(!db->connect())
		return false;

	DBQuery query;
	DBResult result;

	query << "INSERT INTO `guilds` ( `id` , `name` , `ownerid` , `creationdata` , `motd`, `logo_gfx_name` ) VALUES (NULL , '" << Database::escapeString(player->getGuildName()) << "', '" << player->getGUID() << "', '" << time(NULL) << "', 'Your guild has successfully been created, to view all available commands use: <!commands>. If you would like to remove this message use <!cleanmotd>, if you would like to edit it, use <!setmotd newMotd>.', NULL);";
	if(!db->executeQuery(query))
		return false;

	query << "SELECT `id` FROM `guilds` WHERE `ownerid` = " << player->getGUID();
	if(!db->storeQuery(query, result))
		return false;

	player->setGuildId(result.getDataInt("id"));
	player->setGuildLevel(GUILDLEVEL_LEADER);
}

NULL for gfx_logo_name? It is NOT NULL...
 
Back
Top