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

I have problems, all works but dont teleport guilds to islands.

second problems i have information on the page when i click on guilds name :
The Following Errors Have Occurred:
# Guild with ID 0 doesn't exist.

Plx Help!
 
OK I REPAIR THIS PROBLEM
The Following Errors Have Occurred:
# Guild with ID 0 doesn't exist.

BUT I DONT KNOW WHY DONT TELEPORT TEAMS TO ISLAND
 
IF I'am writing /war-challenge i have massage Please writte a correct name
 
Emm I don't know what I am doing wrong... I did everything what is in tutorial but in server if I kill someone who is not in war I will not get a frag ;/ frags are not counting in every kill.

Open login.lua (data/creaturescripts/scripts/):
And after:
Lua:
registerCreatureEvent(cid, "PlayerDeath")
Write:
Lua:
	registerCreatureEvent(cid, "WarAttack")
	registerCreatureEvent(cid, "WarKill")
And save it.

I don't have any "PlayerDeath" in login.lua file.


Tfs 0.3.5

@edit
Ok fixed ; d Sry
 
Last edited:
I don't see link in menu Although i added :

case "wars";
$subtopic = "wars";
$topic = "Wars";
include("wars.php");
break;

in index.php before:

case "buypoints";
$subtopic = "buypoints";
$topic = "Buy Points";
include("buypoints.php");
break;
 
ok, now is good.
but all headers in menu (community, forum etc.)
are opening when i push 'Guild Wars' ;/

I need to guild wars system are working the entire map.

And what's happend?
The Following Errors Have Occurred:
Guild with ID 0 doesn't exist.
 
Last edited:
i still cant make kills get counted... did anyone make it work already?
 
The Following Errors Have Occurred:
# Guild with ID 0 doesn't exist.

still getting this error :/
 
Xamppy posted 2 different system for the homepage. Take the correct one. It depends on your gesior verion....
 
im using TFS 0.3.4pl2 version... and i did everything just like the manual says.. and still getting that error besides kills aren't counted
 
@knt4seb:

Use this:
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>
    * /war-invite :
        <FONT SIZE=1 COLOR=#04B404>
            Send a invitation to start a war.<br>
            Example: /war-invite Pain Factory
        </FONT><br>
    * /war-accept :
        <FONT SIZE=1 COLOR=#04B404>
            Accept the invitation to start a war.
        </FONT><br>
    * /war-reject :
        <FONT SIZE=1 COLOR=#04B404>
            Reject the invitation to start a war.
        </FONT><br>
    * /war-cancel-invite :
        <FONT SIZE=1 COLOR=#04B404>
            Cancel the invitation already snet to star a war.
        </FONT><br>
    * /war-cancel :
        <FONT SIZE=1 COLOR=#04B404>
            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>
<br>
<br>
';
$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
        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='index.php?subtopic=guilds&action=show&guild=" . $v[gname] . "'>$v[gname]</a>
                    </b>
                </center>
            </TD>
            <TD>V/s</TD>
            <TD>
                <center>
                    <b>
                        <a href='index.php?subtopic=guilds&action=show&guild=" . $v[wgname] . "'>$v[wgname]</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    " . date("d/m/y   H:i:s", $v[gtime]) . "
                </center>
            </TD>
            <TD>
                <center>
                    <a href='index.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
        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='index.php?subtopic=guilds&action=show&guild=" . $v[iname] . "'>$v[iname]</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        <a href='index.php?subtopic=guilds&action=show&guild=" . $v[igname] . "'>$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>
        <br>
        <div style="text-align: right; margin: 20px auto; font-size: 10px;">
        Coded by <a target="blank" href="http://otland.net/members/nahruto/">Nahruto</a> and Fixed by <a target="blank" href="http://otland.net/members/xampy/">Xampy</a></div>
    ';
} 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='index.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)
    {
    $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)
        {
            $totDeaths2 = $q[n];
        }
    $membersDeaths2 .="
        <center>
            <b>
                <a href='index.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='index.php?subtopic=characters&name=" . $killedName . "'>$killedName</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        <a href='index.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='index.php?subtopic=characters&name=" . $killedName . "'>$killedName</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        <a href='index.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='index.php?subtopic=guilds&action=show&guild=" . $guild->getName() . "'>
                " . $guild->getName() . "</a> 
        and 
            <a href='index.php?subtopic=guilds&action=show&guild=" . $guild2->getName() . "'>
                " . $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='index.php?subtopic=characters&name=" . $TopFraggerName  . "'>" . $TopFraggerName  . "</a> ($numTop1)
    <br>
    <br>
    Top fragger of " . $guild2->getName() . " = <a href='index.php?subtopic=characters&name=" . $TopFraggerName2  . "'>" . $TopFraggerName2  . "</a> ($numTop2)
    <br>
    <br>
    The most dead of  " . $guild->getName() . " = <a href='index.php?subtopic=characters&name=" . $mostDeadName  . "'>" . $mostDeadName2  . "</a> ($mostDeadNum2)
    <br>
    <br>
    The most dead of  " . $guild2->getName() . " = <a href='index.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>
";
}
?>
 
xampy u are from spain right?
spanish is my native language entonces quizas sea mas facil poder solucionarlo de esta manera xD..

acabo de utilizar el wars.php que acabas de pegar pero me sucede lo mismo :S me sale el error de id de guild desconocida y ademas que en las wars no cuentan las frags ... es muy extraño, tienes una idea de qué pueda ser?
 
@kn4tseb:
Ve al post principal y escoje un archivo PHP de los dos que hay (paso: 6.0 o 6.01). Te tiene que ir uno de los dos...
Lo de que no te cuenta frags puede ser porque no hayas ejecutado las "querys" en la database (paso 5.0) o porque tienes el war_kill.lua "viejo". Cambia el war_kill.lua (paso 2.1)por el que tu tienes y haz lo de phpMyAdmin.
 
xampy xd.. utilice los 2 wars.php, si ejecute los queries en la DB, fue lo primero que hice, incluso reviso en phpmyadminy me aparece la tabla: deaths_in_wars y tb utilice el ultimo war_kill.lua que dejaste, si reviso el post todos los dias :S

PHP:
mysql> 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 ;
ERROR 1060 (42S21): Duplicate column name 'invited_to'
mysql> 
mysql>  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 ;
ERROR 1050 (42S01): Table 'deaths_in_wars' already exists
mysql>


PD: te puedo enviar un contacto tipo msn ??? prometo no molestarte, solo deseo hacer funcionar este sistema que es genial, gracias ;)
 
Last edited:
Ok, enviame tu msn por private.
 
Status
Not open for further replies.
Back
Top