• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Fixed Guild War System for Website [include all]-[will not count frags] (TFS 0.3+)

Status
Not open for further replies.
Code:
data/lib/database.lua:60: [Result:getDataInt]: Result not set!
stack traceback:
        [C]: in function 'error'
        data/lib/database.lua:60: in function 'getDataInt'
        ./GuildWar.lua:225: in function 'guildExist'
        data/talkactions/scripts/GuildWar.lua:9: in function <data/talkactions/s
cripts/GuildWar.lua:3>

Hmmm? ;>
 
I have a problem when i say /war-invite, /war-accept doesn't do nothing :( i dont have any error in my server

EDIT: NVM sry i changed /war-invite to !war-invite in talkaction.xml thats why was not working
 
Have this error now when i say /war-invite
Code:
[28/06/2009 09:50:54] Error during getDataInt(invited_to).
[28/06/2009 09:50:55] Error during getDataInt(invited_by).
[28/06/2009 09:50:55] Error during getDataInt(in_war_with).
[28/06/2009 09:50:55] Error during getDataInt(war_time).
[28/06/2009 09:50:55] Error during getDataInt(invited_to).
[28/06/2009 09:50:55] Error during getDataInt(invited_by).
[28/06/2009 09:50:55] Error during getDataInt(in_war_with).
[28/06/2009 09:50:55] Error during getDataInt(war_time).
[28/06/2009 09:50:55] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: invited_to (UPDATE "guilds" SET "invited_to" = 1 WHERE "id" = 2)
[28/06/2009 09:50:55] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: invited_by (UPDATE "guilds" SET "invited_by" = 2 WHERE "id" = 1)

The Forgotten Server, version 0.3.1 (Crying Damson)
 
@up:
Did you do this?:

5.0Add this to database (phpMyAdmin normally):


PHP:
ALTER TABLE `guilds` 
ADD `invited_to` INT( 11 ) NOT NULL ,
ADD `invited_by` INT( 11 ) NOT NULL ,
ADD `in_war_with` INT( 11 ) NOT NULL ,
ADD `kills` INT( 11 ) NOT NULL ,
ADD `show` SMALLINT( 1 ) NOT NULL ,
ADD `war_time` INT( 11 ) NOT NULL ;

 CREATE TABLE `deaths_in_wars` (
`guild_id` INT( 11 ) NOT NULL ,
`player_id` INT( 11 ) NOT NULL ,
`killer_guild` INT( 11 ) NOT NULL ,
`killer` INT( 11 ) NOT NULL ,
`date` INT( 11 ) NOT NULL 
) ENGINE = MYISAM ;
 
How do I fix this? When you press at one of the guilds at the War invite list or any guild thats on the war list this error comes:

warbug.jpg


At the link it says:
Wofb - Guildsguild=Angels

If I manually goes at the guild the link says:
Wofb - Guildsguild=19

Using the newest geisor page (0.3.4)
When I used the 0.3.2 version it worked.

Also if it matters im using tfs 0.3.4.

Anyone know how I'll be able to fix it?

Thanks in advance =)
 
Last edited:
@Xampy

no i didn't, because i dont have a webpage do i have to make a webpage for this?

and my datebase is forgottenserver.s3db with SQLite
 
@NilssoN:
The frag counter must work if you've done all I said in the tutorial.

@Chojrak:
No problem with that error.

@Kspen:
In short time I'll post the repaired PHP file for 0.3.4

@Azuk:
How did you export the .s3db to database? You must do the same with that.

---------------------------------------------------------------------------------------
PHP File for the Unnamed AAC that works with TFS 0.3.4:
PHP:
<?PHP
//Litle Config
$MaxShow = 20;
//END

if($action == '')
{
$main_content .= '
<P ALIGN=CENTER>
	<br>
	<FONT SIZE=4 COLOR=#8A0808>
		How to use...
	</FONT>
	<br>
	<br>
	<FONT SIZE=2 COLOR=#DF0101>
	* <b>/war-invite</b> :
		<FONT SIZE=1 COLOR=green>
			Send a invitation to start a war.<br>
			<u>Example</u>: /war-invite Pain Factory
		</FONT><br>
	* <b>/war-accept</b> :
		<FONT SIZE=1 COLOR=green>
			Accept the invitation to start a war.
		</FONT><br>
	* <b>/war-reject</b> :
		<FONT SIZE=1 COLOR=green>
			Reject the invitation to start a war.
		</FONT><br>
	* <b>/war-cancel-invite</b> :
		<FONT SIZE=1 COLOR=green>
			Cancel the invitation already snet to star a war.
		</FONT><br>
	* <b>/war-cancel</b> :
		<FONT SIZE=1 COLOR=green>
			Finish the currect war, can only be used after 1 day.
		</FONT><br>
	</FONT>
	<br>
	<FONT SIZE=2 COLOR=#8A0808>
		Those commands can only be executed by guild leaders.<br><br>
		<table border="1"><tr border="1"><td border="1"><h3>Remember:</h3>
		<ul>
		<li>You won\'t get any frag if you kill someone that is VERSUS you.</li>
		<li>If you kill someone that is in your guild, you will get a frag.</li>
		</ul></td></tr></table>
	</FONT>
</P>
';
$wars = $SQL->query("
	SELECT g.name AS gname, wg.name AS wgname, g.war_time AS gtime, g.kills AS kills, wg.kills AS ekills, g.show AS s, g.id AS gid, wg.id AS wgid
		FROM guilds AS g
	INNER JOIN guilds AS wg
		ON wg.id = g.in_war_with
	ORDER BY s DESC LIMIT 50;
");
foreach ($wars as $k=>$v) {
if ($v[s] == 1) 
{
	$stats .="
		<TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=guilds&action=show&guild=" . $v[gid] . "'>$v[gname]</a>
					</b>
				</center>
			</TD>
			<TD>V/s</TD>
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=guilds&action=show&guild=" . $v[wgid] . "'>$v[wgname]</a>
					</b>
				</center>
			</TD>
			<TD>
				<center>
					" . date("d/m/y   H:i:s", $v[gtime]) . "
				</center>
			</TD>
			<TD>
				<center>
					<a href='phaltera.php?subtopic=wars&action=show&war=" . $v[gid] . "'>{$v[kills]} - {$v[ekills]}</a>
				</center>
			</TD>	
		</TR>
	";
}
}
$main_content .= '
	<center>
		<h1>
			Guilds Wars
		</h1>
	</center>
';
if(!$stats) {
	$main_content .= '
		<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
			<TR BGCOLOR="'.$config['site']['vdarkborder'].'">
				<TD CLASS=white>
				</TD>
			</TR>
			<TR BGCOLOR='.$config['site']['darkborder'].'>
				<TD>
					No guilds in war in '.$config['server']['serverName'].' yet.
				</TD>
			</TR>
		</TABLE>
	';
} else {
	$main_content .= "
		<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
			<TR BGCOLOR=\"{$config['site']['vdarkborder']}\">
				<TD CLASS=white width=25%>
					<center><B>Guild</B></center>
				</TD>
				<TD CLASS=white width=5%>
					<B>V/s</B>
				</TD>
				<TD CLASS=white width=25%>
					<center><B>Guild</B></center>
				</TD>
				<TD CLASS=white width=25%>
					<center><B>Started at</B></center>
				</TD>
				<TD CLASS=white width=20%>
					<center><B>Kills</B></center>
				</TD>
			</TR>
			$stats
		</TABLE>
	";	
}

?>

<?PHP
$invitations = $SQL->query("
	SELECT ig.name AS igname, i.name AS iname, i.id AS iid, ig.id AS igid


		FROM guilds AS i
	INNER JOIN guilds AS ig
		ON ig.id = i.invited_to
	ORDER BY iname ASC LIMIT 50;	
");
foreach ($invitations as $k=>$v) {
	$invi .="
		<TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=guilds&action=show&guild=" . $v[iid] . "'>$v[iname]</a>
					</b>
				</center>
			</TD>
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=guilds&action=show&guild=" . $v[igid] . "'>$v[igname]</a>
					</b>
				</center>
			</TD>
			<TD></TD>
		</TR>
	";
}
$main_content .= '
	<center>
		<h1>
			Pending invitations
		</h1>
	</center>
';
if(!$invi) {
	$main_content .= '
		<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
			<TR BGCOLOR="'.$config['site']['vdarkborder'].'">
				<TD CLASS=white>
				</TD>
			</TR>
			<TR BGCOLOR='.$config['site']['darkborder'].'>
				<TD>
					No pending invitations in '.$config['server']['serverName'].'.
				</TD>
			</TR>
		</TABLE>
	';
} else {
	$main_content .= "
		<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
			<TR BGCOLOR=\"{$config['site']['vdarkborder']}\">
				<TD CLASS=white width=50%>
					<center><B>Guild</B></center>
				</TD>		
				<TD CLASS=white width=50%>
					<center><B>Invited guild</B></center>
				</TD>
				</TD>
			</TR>
			$invi
		</TABLE>
	";
}
}

//SHOW FRAGS ~~
if($action == 'show')
{
$guild = $ots->createObject('Guild'); 
$guild->load($_REQUEST['war']);
$ranks = $SQL->query("
	SELECT 
		*
	FROM 
		guild_ranks 
	WHERE 
		guild_id = ". $guild->getId() .";
	");

foreach ($ranks as $y)
{
	$Players = $SQL->query("
	SELECT 
		*
	FROM 
		players 
	WHERE 
		rank_id = ". $y[id] ." 
	ORDER BY
		name
	DESC;");
	foreach ($Players as $v)
	{
	$totDeaths = 0;
	$deaths = $SQL->query("
	SELECT  
		COUNT(player_id) AS n
	FROM 
		deaths_in_wars
	WHERE 
		player_id = ". $v[id] ." 
	GROUP BY 
		player_id
	DESC LIMIT 1;");
		foreach ($deaths as $q)
		{
			$totDeaths = $q[n];
		}
	$membersDeaths .="
		<center>
			<b>
				<a href='phaltera.php?subtopic=characters&name=" . $v[name] . "'>$v[name]</a> ($totDeaths)
			</b>
		</center>
	";
	}
}

$guild2 = $ots->createObject('Guild'); 
$guild2->load($guild->getCustomField(in_war_with));
$ranks2 = $SQL->query("
	SELECT 
		*
	FROM 
		guild_ranks 
	WHERE 
		guild_id = ". $guild2->getId() .";
	");

foreach ($ranks2 as $y)
{
	$Players = $SQL->query("
	SELECT 
		*
	FROM 
		players 
	WHERE 
		rank_id = ". $y[id] ." 
	ORDER BY
		name
	DESC;");
	foreach ($Players as $v)
	{
	$totDeaths2 = 0;
	$deaths = $SQL->query("
	SELECT  
		COUNT(player_id) AS n
	FROM 
		deaths_in_wars
	WHERE 
		player_id = ". $v[id] ." 
	GROUP BY 
		player_id
	DESC LIMIT 1;");
		foreach ($deaths as $q)
		{
			$totDeaths2 = $q[n];
		}
	$membersDeaths2 .="
		<center>
			<b>
				<a href='phaltera.php?subtopic=characters&name=" . $v[name] . "'>$v[name]</a> ($totDeaths2)
			</b>
		</center>
	";
	}
}

$deathsG1 = $SQL->query("
	SELECT 
		* 
	FROM 
		deaths_in_wars 
	WHERE 
		killer_guild = ". $guild->getId() ." 
	ORDER BY 
		date 
	DESC LIMIT ". $MaxShow .";");

$deathsG2 = $SQL->query("
	SELECT 
		* 
	FROM 
		deaths_in_wars 
	WHERE 
		killer_guild = ". $guild2->getId() ." 
	ORDER BY 
		date
	DESC LIMIT ". $MaxShow .";");

$Topfragger1 = $SQL->query("
	SELECT 
		killer, COUNT(killer) maximo
	FROM 
		deaths_in_wars
	WHERE 
		killer_guild = 	". $guild->getId() ." 
	GROUP BY 
		killer
	ORDER BY 
		maximo 
	DESC LIMIT 1;");
	
	foreach ($Topfragger1 as $y) 
		{
			$name = $ots->createObject('Player');
			$name->load($y[killer]);
			$TopFraggerName = $name->getName();
			$numTop1 = $y[maximo];
		}
		
$Topfragger2 = $SQL->query("
	SELECT 
		killer, COUNT(killer) maximo
	FROM 
		deaths_in_wars
	WHERE 
		killer_guild = 	". $guild2->getId() ." 
	GROUP BY 
		killer
	ORDER BY 
		maximo 
	DESC LIMIT 1;");
	
	foreach ($Topfragger2 as $y) 
		{
			$name = $ots->createObject('Player');
			$name->load($y[killer]);
			$TopFraggerName2 = $name->getName();
			$numTop2 = $y[maximo];
		}
		
$mostDead = $SQL->query("
	SELECT 
		player_id, COUNT(player_id) maximo
	FROM 
		deaths_in_wars
	WHERE 
		killer_guild = 	". $guild->getId() ." 
	GROUP BY 
		player_id
	ORDER BY 
		maximo 
	DESC LIMIT 1;");
	
	foreach ($mostDead as $y) 
		{
			$name = $ots->createObject('Player');
			$name->load($y[player_id]);
			$mostDeadName = $name->getName();
			$mostDeadNum = $y[maximo];
		}

$mostDead2= $SQL->query("
	SELECT 
		player_id, COUNT(player_id) maximo
	FROM 
		deaths_in_wars
	WHERE 
		killer_guild = 	". $guild2->getId() ." 
	GROUP BY 
		player_id
	ORDER BY 
		maximo 
	DESC LIMIT 1;");
	
	foreach ($mostDead2 as $y) 
		{
			$name = $ots->createObject('Player');
			$name->load($y[player_id]);
			$mostDeadName2 = $name->getName();
			$mostDeadNum2= $y[maximo];
		}

foreach ($deathsG1 as $k=>$v) {
	
	$killed = $ots->createObject('Player');
	$killed->load($v[player_id]);
	$killedName = $killed->getName();

	$killer = $ots->createObject('Player');
	$killer->load($v[killer]);
	$killerName = $killer->getName();
	
	$kills .="
		<TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=characters&name=" . $killedName . "'>$killedName</a>
					</b>
				</center>
			</TD>
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=characters&name=" . $killerName . "'>$killerName</a>
					</b>
				</center>
			</TD>
			<TD>
				<center>
					" . date("d/m/y   H:i:s", $v[date]) . "
				</center>
			</TD>
		</TR>
	";
}

foreach ($deathsG2 as $k=>$v) {
	
	$killed = $ots->createObject('Player');
	$killed->load($v[player_id]);
	$killedName = $killed->getName();

	$killer = $ots->createObject('Player');
	$killer->load($v[killer]);
	$killerName = $killer->getName();
	
	$kills2 .="
		<TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=characters&name=" . $killedName . "'>$killedName</a>
					</b>
				</center>
			</TD>
			<TD>
				<center>
					<b>
						<a href='phaltera.php?subtopic=characters&name=" . $killerName . "'>$killerName</a>
					</b>
				</center>
			</TD>
			<TD>
				<center>
					" . date("d/m/y   H:i:s", $v[date]) . "
				</center>
			</TD>
		</TR>
	";
}
$main_content .= "
	<center>
	<b>
		<h2>
		War betwen 
			<a href='phaltera.php?subtopic=guilds&action=show&guild=" . $guild->getId() . "'>
				" . $guild->getName() . "</a> 
		and 
			<a href='phaltera.php?subtopic=guilds&action=show&guild=" . $guild2->getId() . "'>
				" . $guild2->getName() . "</a>
		.
		</h2>
	<br>
	Started at : </b>" . date("d/m/y   H:i:s", $guild->getCustomField(war_time)) . "
	<br>
	<br>
	<b>
	Total Frags by " . $guild->getName() . " = " . $guild->getCustomField(kills) . "
	<br>
	<br>
	Total Frags by " . $guild2->getName() . " = " . $guild2->getCustomField(kills) . "
	<br>
	<br>
	Top fragger of " . $guild->getName() . " = <a href='phaltera.php?subtopic=characters&name=" . $TopFraggerName  . "'>" . $TopFraggerName  . "</a> ($numTop1)
	<br>
	<br>
	Top fragger of " . $guild2->getName() . " = <a href='phaltera.php?subtopic=characters&name=" . $TopFraggerName2  . "'>" . $TopFraggerName2  . "</a> ($numTop2)
	<br>
	<br>
	The most dead of  " . $guild->getName() . " = <a href='phaltera.php?subtopic=characters&name=" . $mostDeadName  . "'>" . $mostDeadName2  . "</a> ($mostDeadNum2)
	<br>
	<br>
	The most dead of  " . $guild2->getName() . " = <a href='phaltera.php?subtopic=characters&name=" . $mostDeadName2  . "'>" . $mostDeadName  . "</a> ($mostDeadNum)	
	</b>
	</center>
	<br>
	<br>
	<br>
	
";

$main_content .= "
	<center>
	<h1>
		Members Deaths
	</h1>
	<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
		<TR BGCOLOR=\"{$config['site']['vdarkborder']}\">
			<TD CLASS=white width=50%>
				<center>
					<B>
						". $guild->getName() ."
					</B>
				</center>
			</TD>
			<TD CLASS=white width=50%>
				<center>
					<B>
						". $guild2->getName() ."
					</B>
				</center>
			</TD>
		</TR>
		<TR BGCOLOR=\"".$config['site']['darkborder']."\">
			<TD>
				$membersDeaths
			</TD>
			<TD>
				$membersDeaths2
			</TD>
		</TR>


	</TABLE>
	</center>
	<br>
	<br>
	<br>
	<center>
		<h1>
			Latest frags by ". $guild->getName() ."
		</h1>
	</center>
	<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
		<TR BGCOLOR=\"{$config['site']['vdarkborder']}\">
			<TD CLASS=white width=35%>
				<center>
					<B>
						Player
					</B>
				</center>
			</TD>
			<TD CLASS=white width=35%>
				<center>
					<B>
						Killed by
					</B>
				</center>
			</TD>
			<TD CLASS=white width=30%>
				<center>
					<B>
						Date
					</B>
				</center>
			</TD>
		</TR>
		$kills
	</TABLE>
		<center>
		<h1>
			Latest frags by ". $guild2->getName() ."
		</h1>
	</center>
	<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
		<TR BGCOLOR=\"{$config['site']['vdarkborder']}\">
			<TD CLASS=white width=35%>
				<center>
					<B>
						Player
					</B>
				</center>
			</TD>
			<TD CLASS=white width=35%>
				<center>
					<B>
						Killed by
					</B>
				</center>
			</TD>
			<TD CLASS=white width=30%>
				<center>
					<B>
						Date
					</B>
				</center>
			</TD>
		</TR>
		$kills2
	</TABLE>
";
}
?>
 
Last edited:
Bugs to fix:
-If player1 have war with player2 then if player1 kill player2 the frag will not count, then if player1 kill someone else not from the war it will have a frag (warning the murder of xxx was not justifed etc.) but then if player1 kill again player2 from the war it will get normal frag ! (warning the murder of xxx was not justifed !) :S

-/war-challenge command is not working properly.
 
@ScorpiOOn93:
Okey, I'll fix the first bug.
The bug with challenge... Can you tell me for what is the challenge?, cos' I didn't wite the code. It will teleport both guilds to same area to have a war X minutes? That's? Tell me. xD
 
Okey! I'll fix both errors. I won't say you when I'll put the fixed codes here, but I will put them.
 
@Xampy i dont remember how i export the .s3db
i think i just downloaded like this files called
iconv.dll
zlib1.dll
mysql.dll
sqlite3.dll
lua5.1.dll
libxml2.dll
libmysql.dll
libxml2-2.dll
libiconv-2.dll

dont know if the .s3db was there before
 
@up:
I didn't never tried SQLite, so I don't know how to export a .s3db to database.
Let me try it.
 
however you forgot credits to christiandb because he is the one who told me step to step what to do.
 
@Azuk:
I tested SQLite and I don't know how it works. Maybe you must add what I put to you (the tables I said you that you must done with phpMyAdmin) into the .s3db file. Try to open the file with Notepad or something like that.

@Nahruto:
I couldn't give him credits cos' I didn't know that christiandb helped on this.

@Zonet:
XDD
 
@Xampy
oi now im using mysql but i dont know how this thing work xD could u tell me where in phpMyAdmin because here i have 8 files in there XD
Code:
ALTER TABLE `guilds` 
ADD `invited_to` INT( 11 ) NOT NULL ,
ADD `invited_by` INT( 11 ) NOT NULL ,
ADD `in_war_with` INT( 11 ) NOT NULL ,
ADD `kills` INT( 11 ) NOT NULL ,
ADD `show` SMALLINT( 1 ) NOT NULL ,
ADD `war_time` INT( 11 ) NOT NULL ;

 CREATE TABLE `deaths_in_wars` (
`guild_id` INT( 11 ) NOT NULL ,
`player_id` INT( 11 ) NOT NULL ,
`killer_guild` INT( 11 ) NOT NULL ,
`killer` INT( 11 ) NOT NULL ,
`date` INT( 11 ) NOT NULL 
) ENGINE = MYISAM ;
 
Status
Not open for further replies.
Back
Top