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

Advanced-Guild-War-System {Count in site the frags!} Now Edited with tables of DB!

Hello
where do i need to put this things.

Code:
DelayToLeave = 12 * 60 * 60

BroadCast_Type = MESSAGE_EVENT_ADVANCE

Need_rank = GUILDLEVEL_LEADER

--Functions ~.
function WarInfo(guild)
    local Info = db.getResult("SELECT * FROM `guilds` WHERE `id` = " .. guild .. ";")
    if Info:getID() ~= LUA_ERROR then
        local inWar, inTeam, invitedTo, JoinDate = Info:getDataInt("war"), Info:getDataInt("team"), Info:getDataInt("invited_to_war"), Info:getDataInt("join_date")
        Info:free()
        return {War = inWar, Team = inTeam, Inv = invitedTo, Joined = JoinDate}
    end
     return LUA_ERROR
end

function getGuildNameById(guild)
    local Info = db.getResult("SELECT * FROM `guilds` WHERE `id` = " .. guild .. ";")
        if Info:getID() ~= LUA_ERROR then
        local Name = Info:getDataString("name")
        Info:free()
        return Name
    end
     return LUA_ERROR
end

function getGuildIdByName(name)
    local Get = db.getResult("SELECT `id` FROM `guilds` WHERE `name` = " .. db.escapeString(name) .. ";")
    if Get:getID() ~= LUA_ERROR then
        local ret = Get:getDataInt("id")
        Get:free()
        return ret
    end
     return LUA_ERROR
end

function IsInPeace(guild)
    local Info = WarInfo(guild)
    return (Info.War == 0 and Info.Team == 0 and Info.Inv == 0)
end

function cleanInfo(guild)
    db.executeQuery("UPDATE `guilds` SET `war` = 0, `team` = 0, `invited_to_war` = 0, join_date = 0 WHERE `id` = ".. guild ..";")
end

function createWar()
    db.executeQuery("INSERT INTO `wars` (`date`, `status`, `team_one_kills`, `team_two_kills`, `end_date`) VALUES (" .. os.time() .. ", 1, 0, 0, 0);")
    local This = db.getResult("SELECT * FROM `wars` ORDER BY `id` DESC LIMIT 1;")
    return This:getDataInt("id")
end

function inviteToWar(Guild, War, Team)
    db.executeQuery("UPDATE `guilds` SET `team` = " .. Team ..", `invited_to_war` = " .. War .. " WHERE `id` = ".. Guild ..";")
end

function updateWarInfo(Guild, warId, team)
    db.executeQuery("UPDATE `guilds` SET `war` = " .. warId .. ", `team` = " .. team .. ", `invited_to_war` = 0, join_date = " .. os.time() .. " WHERE `id` = ".. Guild ..";")
end

function leaveWar(Guild)
    if checkGuildsInThisWar(WarInfo(Guild).War) == 1 then
        db.executeQuery("UPDATE `wars` SET `status` = 0, `end_date` = " .. os.time() .. " WHERE `id` = ".. WarInfo(Guild).War ..";")
    end
    cleanInfo(Guild)
end

function removeFrag(cid)
    local FragTime = getConfigInfo('timeToDecreaseFrags')
    local myFragTime = getPlayerRedSkullTicks(cid)
    local Remo = (myFragTime - FragTime)
    if Remo < 0 then
        Remo = 0
    end
    doPlayerSetRedSkullTicks(cid, Remo)
end

function checkGuildsInThisWar(war)
    local res = db.getResult("SELECT * FROM `guilds` WHERE `war` = " .. war .. ";")
    local Guilds = {}
    if res:getID() ~= LUA_ERROR then
        while true do
            table.insert(Guilds, res:getDataInt "id")
            if not res:next() then
                break
            end
        end
        res:free()
    end
    return #Guilds
end
Code:
<?PHP
$MaxShow_of_frags = 20;

if($action == '')
{
$wars = $SQL->query("SELECT * FROM wars WHERE status = 1 ORDER BY date DESC;");

foreach ($wars as $k=>$v)
{
    $guilds_one = "";
    $guilds_two = "";
    
    $team_one = $SQL->query("SELECT * FROM guilds WHERE war = ". $v[id] ."  AND team = 1;");
    $team_one_tot = 0;
    foreach ($team_one as $guild)
    {
        $team_one_tot++;
        $guilds_one .= "<a href='index.php?subtopic=guilds&action=show&guild=" . $guild[name] . "'>$guild[name]</a><br>";
    }
    $team_two = $SQL->query("SELECT * FROM guilds WHERE war = ". $v[id] ."  AND team = 2;");
    $team_two_tot = 0;
    foreach ($team_two as $guild)
    {
        $team_two_tot++;
        $guilds_two .= "<a href='index.php?subtopic=guilds&action=show&guild=" . $guild[name] . "'>$guild[name]</a><br>";
    }
        $stats .="
            <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
                <TD>
                    <center>
                        ".(!$guilds_one ? "-/-" :"$guilds_one")."
                    </center>
                </TD>
                <TD>
                    <center>
                        ".(!$guilds_two ? "-/-" :"$guilds_two")."
                    </center>
                </TD>
                <TD>
                    <center>
                        ".($v[status] == 1 ? "<font color='green'><b>Active</b></font><br>Since " . date("d/m/y   H:i:s", $v[date]) . "" : "<font color='red'><b>Ended</b></font><br>At " . date("d/m/y   H:i:s", $v[end_date]) . "")."
                    </center>
                </TD>
                <TD>
                    <center>
                        <b>
                            " . $v[team_one_kills] . " / " . $v[team_two_kills] . "
                        </b>
                    </center>
                </TD>
                <TD>
                    <center>
                        <a href='index.php?subtopic=new_wars&action=show&war=" . $v[id] . "'>View</a>
                    </center>
                </TD>
            </TR>
    ";
}
$main_content .= '
    <center>
        <h1>
            Wars
        </h1>
    </center>
';
if(!$stats) {
    $main_content .= '
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
            <TR BGCOLOR="'.$config['site']['vdarkborder'].'">
                <TD CLASS=white>
                    Status
                </TD>
            </TR>
            <TR BGCOLOR='.$config['site']['darkborder'].'>
                <TD>
                    There are no wars 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>
                            Team One
                        </B>
                    </center>
                </TD>
                <TD CLASS=white width=25%>
                    <center>
                        <B>
                            Team Two
                        </B>
                    </center>
                </TD>
                <TD CLASS=white width=25%>
                    <center>
                        <B>
                            Status
                        </B>
                    </center>
                </TD>
                <TD CLASS=white width=15%>
                    <center>
                        <B>
                            Scores
                        </B>
                    </center>
                </TD>
                <TD CLASS=white width=10%>
                    <center>
                        <B>
                            View
                        </B>
                    </center>
                </TD>
            </TR>
            $stats
        </TABLE>
    ";    
    }
}
if($action == 'show')
{
    $war_id = $_REQUEST['war'];
    
    $war = $SQL->query("SELECT * FROM wars WHERE id = ". $war_id ." LIMIT 1;");

    foreach ($war as $v)
    {
        $team_one = $SQL->query("SELECT * FROM guilds WHERE war = ". $v[id] ."  AND team = 1;");
        
        $team_one_tot = 0;
        
        foreach ($team_one as $guild)
        {
            $team_one_tot++;
            //Show guilds in team one.
            $guilds_one .= "<a href='index.php?subtopic=guilds&action=show&guild=" . $guild[name] . "'>$guild[name]</a> ";
        }
        $team_two = $SQL->query("SELECT * FROM guilds WHERE war = ". $v[id] ."  AND team = 2;");
        
        $team_two_tot = 0;
        
        foreach ($team_two as $guild)
        {
            $team_two_tot++;
            //Show guilds in team two.
            $guilds_two .= "<a href='index.php?subtopic=guilds&action=show&guild=" . $guild[name] . "'>$guild[name]</a> ";
        }
        
        //Get top fragger in team one.
        $Top_fragger_one = $SQL->query("
            SELECT
                killer, COUNT(killer) maximo
            FROM
                war_deaths
            WHERE
                war_id = ". $war_id ."
            AND
                team = 1
            GROUP BY
                killer
            ORDER BY
                maximo
            DESC LIMIT 1;
        ");
        
        foreach ($Top_fragger_one as $x)
        {
            $plyr = $ots->createObject('Player');
            $plyr->load($x[killer]);
            $Top_Fragger_one = $plyr->getName();
            $top_one_rank = $plyr->getRankId();
            $num_Top_one = $x[maximo];
        }
        
        if($top_one_rank)
        {
            //Get the guild of the top fragger one ~
            $ranks_one = $SQL->query("
            SELECT
                g.name AS name
            FROM
                guilds AS g
            INNER JOIN
                guild_ranks AS gr
            ON
                gr.guild_id = g.id
            WHERE
                gr.id = " . $top_one_rank . "
            LIMIT 1
            ");
            
            foreach ($ranks_one as $r_one)
            {
                $g_name_top_one = $r_one[name];
            }
        }
        
        //Get top fragger in team two.
        $Top_fragger_two = $SQL->query("
            SELECT
                killer, COUNT(killer) maximo
            FROM
                war_deaths
            WHERE
                war_id = ". $war_id ."
            AND
                team = 2
            GROUP BY
                killer
            ORDER BY
                maximo
            DESC LIMIT 1;
        ");
    
        foreach ($Top_fragger_two as $x)
        {
            $plyr = $ots->createObject('Player');
            $plyr->load($x[killer]);
            $Top_Fragger_two = $plyr->getName();
            $top_two_rank = $plyr->getRankId();
            $num_Top_two = $x[maximo];
        }
        
        if($top_two_rank)
        {
            //Get the guild of the top fragger two~
            $ranks_two = $SQL->query("
            SELECT
                g.name AS name
            FROM
                guilds AS g
            INNER JOIN
                guild_ranks AS gr
            ON
                gr.guild_id = g.id
            WHERE
                gr.id = " . $top_two_rank . "
            LIMIT 1
            ");
            
            foreach ($ranks_two as $r_two)
            {
                $g_name_top_two = $r_two[name];
            }
        }
        
        //Get most dead in team one.
        $most_d_one = $SQL->query("
            SELECT
                target, COUNT(target) maximo
            FROM
                war_deaths
            WHERE
                war_id = ". $war_id ."
            AND
                team = 2
            GROUP BY
                target
            ORDER BY
                maximo
            DESC LIMIT 1;
        ");
    
        foreach ($most_d_one as $x)
        {
            $plyr = $ots->createObject('Player');
            $plyr->load($x[target]);
            $Most_d_one = $plyr->getName();
            $most_one_rank = $plyr->getRankId();
            $num_most_one = $x[maximo];
        }
        
        if($most_one_rank)
        {
            //Get the guild of the most dead one ~
            $ranks_one = $SQL->query("
            SELECT
                g.name AS name
            FROM
                guilds AS g
            INNER JOIN
                guild_ranks AS gr
            ON
                gr.guild_id = g.id
            WHERE
                gr.id = " . $most_one_rank . "
            LIMIT 1
            ");
            
            foreach ($ranks_one as $r_one)
            {
                $most_one_g = $r_one[name];
            }
        }
        
        //Get most dead in team two.
        $most_d_two = $SQL->query("
            SELECT
                target, COUNT(target) maximo
            FROM
                war_deaths
            WHERE
                war_id = ". $war_id ."
            AND
                team = 1
            GROUP BY
                target
            ORDER BY
                maximo
            DESC LIMIT 1;
        ");
    
        foreach ($most_d_two as $x)
        {
            $plyr = $ots->createObject('Player');
            $plyr->load($x[target]);
            $Most_d_two = $plyr->getName();
            $most_two_rank = $plyr->getRankId();
            $num_most_two = $x[maximo];
        }
        
        if($most_two_rank)
        {
            //Get the guild of the most dead one ~
            $ranks_two = $SQL->query("
            SELECT
                g.name AS name
            FROM
                guilds AS g
            INNER JOIN
                guild_ranks AS gr
            ON
                gr.guild_id = g.id
            WHERE
                gr.id = " . $most_two_rank . "
            LIMIT 1
            ");
            
            foreach ($ranks_two as $r_two)
            {
                $most_two_g = $r_two[name];
            }
        }
        
        
        //Get number of deaths of every member.(team one)
        $team_one_guilds = $SQL->query("SELECT * FROM guilds WHERE war = ". $war_id ." AND team = 1;");
        foreach ($team_one_guilds as $t_one)
        {
            $ranks = $SQL->query("SELECT * FROM guild_ranks WHERE guild_id = ". $t_one[id] .";");
            foreach ($ranks as $y)
            {
                $Players = $SQL->query("SELECT * FROM players WHERE rank_id = ". $y[id] ." ORDER BY name DESC;");
                foreach ($Players as $k=>$x)
                {
                    $totDeaths = 0;
                    $deaths = $SQL->query("SELECT * FROM war_deaths WHERE war_id = ". $war_id ." AND target = ". $x[id] .";");
                    foreach ($deaths as $s) {$totDeaths++;}                
                    
                    $totKills = 0;
                    $Kills = $SQL->query("SELECT * FROM war_deaths WHERE war_id = ". $war_id ." AND killer = ". $x[id] .";");
                    foreach ($Kills as $s) {$totKills++;}        
                    
                    $membersDeaths .="
                        <center>
                            <b>
                                <a href='index.php?subtopic=characters&name=" . $x[name] . "'>$x[name]</a> - <a href='index.php?subtopic=guilds&action=show&guild=" . $t_one[name] . "'>$t_one[name]</a> $totDeaths / $totKills
                            </b>
                        </center>            
                    ";
                }
            }
        }
        //Get number of deaths of every member.(team two)
        $team_two_guilds = $SQL->query("SELECT * FROM guilds WHERE war = ". $war_id ." AND team = 2;");
        foreach ($team_two_guilds as $t_two)
        {
            $ranks = $SQL->query("SELECT * FROM guild_ranks WHERE guild_id = ". $t_two[id] .";");
            foreach ($ranks as $y)
            {
                $Players = $SQL->query("SELECT * FROM players WHERE rank_id = ". $y[id] ." ORDER BY name DESC;");
                foreach ($Players as $k=>$x)
                {
                    $totDeaths = 0;
                    $deaths = $SQL->query("SELECT * FROM war_deaths WHERE war_id = ". $war_id ." AND target = ". $x[id] .";");
                    foreach ($deaths as $s) {$totDeaths++;}

                    $totKills = 0;
                    $Kills = $SQL->query("SELECT * FROM war_deaths WHERE war_id = ". $war_id ." AND killer = ". $x[id] .";");
                    foreach ($Kills as $s) {$totKills++;}    
                    
                    $membersDeaths_two .="
                        <center>
                            <b>
                                <a href='index.php?subtopic=characters&name=" . $x[name] . "'>$x[name]</a> - <a href='index.php?subtopic=guilds&action=show&guild=" . $t_two[name] . "'>$t_two[name]</a> $totDeaths / $totKills
                            </b>
                        </center>        
            
                ";
                }
            }
        }
        //Latest frags (team one)
        $deaths_team_one = $SQL->query("SELECT * FROM war_deaths WHERE war_id = ". $war_id ." AND team = 1 ORDER BY date DESC LIMIT ". $MaxShow_of_frags .";");
        
        foreach ($deaths_team_one as $k=>$t)
        {
            $target = $ots->createObject('Player');
            $target->load($t[target]);
            $targetName = $target->getName();
            $targetLevel = $target->getLevel();

            $killer = $ots->createObject('Player');
            $killer->load($t[killer]);
            $killerName = $killer->getName();
            $killerLevel = $killer->getLevel();
            
            $target_g = $ots->createObject('Guild');
            $target_g->load($t[t_guild]);
            $target_g_Name = $target_g->getName();
            
            $killer_g = $ots->createObject('Guild');
            $killer_g->load($t[k_guild]);
            $killer_g_Name = $killer_g->getName();
            
            $last_kills_one .="
                <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
                    <TD>
                        <center>
                            <b>
                                <a href='index.php?subtopic=characters&name=" . $targetName . "'>$targetName</a> [$targetLevel] - <a href='index.php?subtopic=guilds&action=show&guild=" . $target_g_Name . "'>$target_g_Name</a>
                            </b>
                        </center>
                    </TD>
                    <TD>
                        <center>
                            <b>
                                <a href='index.php?subtopic=characters&name=" . $killerName . "'>$killerName</a> [$killerLevel] - <a href='index.php?subtopic=guilds&action=show&guild=" . $killer_g_Name . "'>$killer_g_Name</a>
                            </b>
                        </center>
                    </TD>
                    <TD>
                        <center>
                            <b>
                                " . date("d/m/y   H:i:s", $t[date]) . "
                            </b>
                        </center>
                    </TD>
                </TR>
            ";
        }
        //Latest frags (team two)
        $deaths_team_one = $SQL->query("SELECT * FROM war_deaths WHERE war_id = ". $war_id ." AND team = 2 ORDER BY date DESC LIMIT ". $MaxShow_of_frags .";");
        
        foreach ($deaths_team_one as $k=>$t)
        {
            $target = $ots->createObject('Player');
            $target->load($t[target]);
            $targetName = $target->getName();
            $targetLevel = $target->getLevel();

            $killer = $ots->createObject('Player');
            $killer->load($t[killer]);
            $killerName = $killer->getName();
            $killerLevel = $killer->getLevel();
            
            $target_g = $ots->createObject('Guild');
            $target_g->load($t[t_guild]);
            $target_g_Name = $target_g->getName();
            
            $killer_g = $ots->createObject('Guild');
            $killer_g->load($t[k_guild]);
            $killer_g_Name = $killer_g->getName();
            
            $last_kills_two .="
                <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
                    <TD>
                        <center>
                            <b>
                                <a href='index.php?subtopic=characters&name=" . $targetName . "'>$targetName</a> [$targetLevel] - <a href='index.php?subtopic=guilds&action=show&guild=" . $target_g_Name . "'>$target_g_Name</a>
                            </b>
                        </center>
                    </TD>
                    <TD>
                        <center>
                            <b>
                                <a href='index.php?subtopic=characters&name=" . $killerName . "'>$killerName</a> [$killerLevel] - <a href='index.php?subtopic=guilds&action=show&guild=" . $killer_g_Name . "'>$killer_g_Name</a>
                            </b>
                        </center>
                    </TD>
                    <TD>
                        <center>
                            <b>
                                " . date("d/m/y   H:i:s", $t[date]) . "
                            </b>
                        </center>
                    </TD>
                </TR>
            ";
        }
        
        //Get invited guilds
        $invited = $SQL->query("SELECT * FROM guilds WHERE invited_to_war = ". $war_id .";");
        
        foreach ($invited as $k=>$t)
        {
            $invi .="
                <TR BGCOLOR=\"".$config['site'][($k % 2 == 1 ? 'light' : 'dark').'border']."\">
                    <TD>
                        <center>
                            <b>
                                <a href='index.php?subtopic=guilds&action=show&guild=" . $t[name] . "'>$t[name]</a>
                            </b>
                        </center>
                    </TD>
                    <TD>
                        <center><b>Team $t[team]</b></center>
                    </TD>
                </TR>
            ";            
        }
        
        
        //Get the title and basic info.
        $title = "$guilds_one($team_one_tot) v/s ".($guilds_two ? "$guilds_two($team_two_tot)" : "~~~~")."";
        
        $info = "
        ".($v[status] == 1 ? "<font color='green'><b>Active</b></font><br>Since " . date("d/m/y   H:i:s", $v[date]) . "" : "<font color='red'><b>Ended</b></font><br>At " . date("d/m/y   H:i:s", $v[end_date]) . "")."
        <br>
        <br>
        Frags by team one = " . $v[team_one_kills] . "
        <br>
        <br>
        Frags by team two = " . $v[team_two_kills] . "
        <br>
        <br>
        Top fragger of team one = ".(!$Top_Fragger_one ? "-/-" : "<a href='index.php?subtopic=characters&name=" . $Top_Fragger_one ."'>$Top_Fragger_one</a> of <a href='index.php?subtopic=guilds&action=show&guild=" . $g_name_top_one . "'>$g_name_top_one</a> ($num_Top_one)")."
        <br>
        <br>
        Top fragger of team two = ".(!$Top_Fragger_two ? "-/-" : "<a href='index.php?subtopic=characters&name=" . $Top_Fragger_two . "'>$Top_Fragger_two</a> of <a href='index.php?subtopic=guilds&action=show&guild=" . $g_name_top_two . "'>$g_name_top_two</a> ($num_Top_two)")."
        <br>
        <br>
        The most one killed of team one = ".(!$Most_d_one ? "-/-" : "<a href='index.php?subtopic=characters&name=" . $Most_d_one . "'>$Most_d_one</a> of <a href='index.php?subtopic=guilds&action=show&guild=" . $most_one_g . "'>$most_one_g</a> ($num_most_one)")."
        <br>
        <br>
        The most one killed of team two = ".(!$Most_d_two ? "-/-" : "<a href='index.php?subtopic=characters&name=" . $Most_d_two . "'>$Most_d_two</a> of <a href='index.php?subtopic=guilds&action=show&guild=" . $most_two_g . "'>$most_two_g</a> ($num_most_two)")."
        ";
    }
    
    //Start the show off work.
    $main_content .= "<center><h2>$title</h2></center><br><br>";
    
    $main_content .= "<center><b>$info</b></center><br><br>";
    
    $main_content .= "
        <center><h3>Members Deaths</h3></center>
        
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=0 WIDTH=100%>
            <TR BGCOLOR=\"{$config['site']['vdarkborder']}\">
                <TD CLASS=white width=50%>
                    <center><b>Team one deaths/kills</b></center>
                </TD>
                <TD CLASS=white width=50%>
                    <center><b>Team two deaths/kills</b></center>
                </TD>
            </TR>
            <TR BGCOLOR=\"".$config['site']['darkborder']."\">
                <TD>
                    ".($membersDeaths ? "$membersDeaths" : "~~")."
                </TD>
                <TD>
                    ".($membersDeaths_two ? "$membersDeaths_two" : "<center>-/-</center>")."
                </TD>
            </TR>
        </TABLE>
        <br>
        <br>
        ";

    $main_content .= "
        <center><h3>Latest frags by Team one</h3></center>
        
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 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>
            ".(!$last_kills_one ? "<TR BGCOLOR=\"{$config['site']['darkborder']}\"><TD><center>-/-</center></TD><TD><center>-/-</center></TD><TD><center>-/-</center></TD></TR>" : "$last_kills_one")."
        </TABLE>
        <br>
        <br>
        ";
        
        $main_content .= "
        <center><h3>Latest frags by Team two</h3></center>
        
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 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>
            ".(!$last_kills_two ? "<TR BGCOLOR=\"{$config['site']['darkborder']}\"><TD><center>-/-</center></TD><TD><center>-/-</center></TD><TD><center>-/-</center></TD></TR>" : "$last_kills_two")."
        </TABLE>
        <br>
        <br>
        ";
        
        $main_content .= "
        <center><h3>Invited guilds</h3></center>
        
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH=100%>
            <TR BGCOLOR=\"{$config['site']['vdarkborder']}\">
                <TD CLASS=white width=35%>
                    <center>
                        <B>
                            Guild
                        </B>
                    </center>
                </TD>
                <TD CLASS=white width=35%>
                    <center>
                        <B>
                            Inivted to team
                        </B>
                    </center>
                </TD>
            </TR>
            ".(!$invi ? "<TR BGCOLOR=\"{$config['site']['darkborder']}\"><TD><center>-/-</center></TD><TD><center>-/-</center></TD></TR>" : "$invi")."
        </TABLE>
        ";
        
    $main_content .= "<br><br><br><br><center><a href='index.php?subtopic=new_wars'><h1>Back</h1></a></center>";
}
?>
Code:
dofile("./Wars.lua")

function onSay(cid, words, param)
    local myGuild = getPlayerGuildId(cid)
    if myGuild ~= 0 then
        local myInfo = WarInfo(myGuild)
        if getPlayerGuildLevel(cid) >= Need_rank then
            if words == "/create-war" then
                if IsInPeace(myGuild) == true then
                    local newWar = createWar()
                    updateWarInfo(myGuild, newWar, 1)
                    doBroadcastMessage(getCreatureName(cid).." leader of "..getGuildNameById(myGuild).." has started a new war.", BroadCast_Type)
                else
                    doPlayerSendCancel(cid, "Your guild is already in a war or have a pending invitation.")
                end
            elseif words == "/leave-war" then
                if myInfo.War ~= 0 then
                    if (os.time() - myInfo.Joined) >= (DelayToLeave) then
                        leaveWar(myGuild)
                        doBroadcastMessage(getCreatureName(cid).." leader of "..getGuildNameById(myGuild).." has left the war.", BroadCast_Type)
                    else
                        doPlayerSendCancel(cid, "You would wait " .. ((DelayToLeave/60)/60) .. " Hours to leave the war.")
                    end
                else
                    doPlayerSendCancel(cid, "Your guild is not in any war.")
                end
            elseif words == "/reject-war" then
                if myInfo.Inv ~= 0 then
                    cleanInfo(myGuild)
                    doBroadcastMessage(getCreatureName(cid).." leader of "..getGuildNameById(myGuild).." has reject the initatio to join the war.", BroadCast_Type)
                else
                    doPlayerSendCancel(cid, "Your guild does not have any pending invitation.")
                end
            elseif words == "/join-war" then
                if myInfo.Inv ~= 0 then
                    updateWarInfo(myGuild, myInfo.Inv, myInfo.Team)
                    doBroadcastMessage(getCreatureName(cid).." leader of "..getGuildNameById(myGuild).." has accepted the initation to join the team " .. myInfo.Team .. " of the war.", BroadCast_Type)
                else
                    doPlayerSendCancel(cid, "Your guild does not have any pending invitation.")
                end
            elseif words == "/invite-enemy" then
                if myInfo.War ~= 0 then
                    if param ~= "" then
                        local enemyGuild = getGuildIdByName(param)
                        if enemyGuild ~= LUA_ERROR then
                            if IsInPeace(enemyGuild) == true then
                                inviteToWar(enemyGuild, myInfo.War, (myInfo.Team == 1 and 2 or 1))
                                doBroadcastMessage(getCreatureName(cid).." leader of "..getGuildNameById(myGuild).." has invited " .. getGuildNameById(enemyGuild) .. " to join their war as enemy.", BroadCast_Type)
                            else
                                doPlayerSendCancel(cid, "This guild is already in a war or have a pending invitation.")
                            end
                        else
                            doPlayerSendCancel(cid, "Write a correct guild name.")
                        end
                    else
                        doPlayerSendCancel(cid, "Write the name of the guild.")
                    end
                else
                    doPlayerSendCancel(cid, "Your guild is not in any war.")
                end
            elseif words == "/invite-ally" then
                if myInfo.War ~= 0 then
                    if param ~= "" then
                        local enemyGuild = getGuildIdByName(param)
                        if enemyGuild ~= LUA_ERROR then
                            if IsInPeace(enemyGuild) == true then
                                inviteToWar(enemyGuild, myInfo.War, myInfo.Team)
                                doBroadcastMessage(getCreatureName(cid).." leader of "..getGuildNameById(myGuild).." has invited " .. getGuildNameById(enemyGuild) .. " to join their war as ally.", BroadCast_Type)
                            else
                                doPlayerSendCancel(cid, "This guild is already in a war or have a pending invitation.")
                            end
                        else
                            doPlayerSendCancel(cid, "Write a correct guild name.")
                        end
                    else
                        doPlayerSendCancel(cid, "Write the name of the guild.")
                    end
                else
                    doPlayerSendCancel(cid, "Your guild is not in any war.")
                end
            end
        else
            doPlayerSendCancel(cid, "You can\'t execute this command.")
        end
    else
        doPlayerSendCancel(cid, "You can\'t execute this command.")
    end
    return TRUE
end
 
"This is best release for ultimate times!!!!!" <- Loved this sentence, though it was pretty much the only sentence which I understood from the entire post, what's this entire things purpose? ;o
 
Why would you release this.. Only certian servers have it and that makes them special/ But now every server will have this and it will make it nooby.
 
Tables? :s
and.. I don't get annything of this, lal
 
Last edited:
i have this error in engine
PHP:
[13/03/2009 17:10:36] Lua Script Error: [TalkAction Interface] 
[13/03/2009 17:10:36] data/talkactions/scripts/moje/GuildWar.lua:onSay

[13/03/2009 17:10:36] data/talkactions/scripts/moje/GuildWar.lua:7: attempt to call global 'GuildIsInPEace' (a nil value)
[13/03/2009 17:10:36] stack traceback:
[13/03/2009 17:10:36] 	data/talkactions/scripts/moje/GuildWar.lua:7: in function <data/talkactions/scripts/moje/GuildWar.lua:3>
i have onther wronk
PHP:
[13/03/2009 17:12:27] Lua Script Error: [TalkAction Interface] 
[13/03/2009 17:12:27] data/talkactions/scripts/moje/GuildWar.lua:onSay

[13/03/2009 17:12:27] data/talkactions/scripts/moje/GuildWar.lua:7: attempt to call global 'GuildIsInPEace' (a nil value)
[13/03/2009 17:12:27] stack traceback:
[13/03/2009 17:12:27] 	data/talkactions/scripts/moje/GuildWar.lua:7: in function <data/talkactions/scripts/moje/GuildWar.lua:3>
[13/03/2009 17:17:17] Reloaded talk actions.
[13/03/2009 17:17:22] mysql_real_query(): SELECT `invited_to`, `invited_by`, `in_war_with`,`war_time` FROM `guilds` WHERE `id` = 3: MYSQL ERROR: Unknown column 'invited_to' in 'field list'

[13/03/2009 17:17:22] Lua Script Error: [TalkAction Interface] 
[13/03/2009 17:17:22] data/talkactions/scripts/moje/GuildWar.lua:onSay

[13/03/2009 17:17:22] ./data/GuildWar.lua:128: attempt to index local 'Info' (a number value)
[13/03/2009 17:17:22] stack traceback:
[13/03/2009 17:17:22] 	./data/GuildWar.lua:128: in function 'GuildIsInPEace'
[13/03/2009 17:17:22] 	data/talkactions/scripts/moje/GuildWar.lua:7: in function <data/talkactions/scripts/moje/GuildWar.lua:3>
 
Last edited:
I've done the tables and I will test it.
Tnx for scripts.


#Edit
KK it has a bugs.
All is working without counting frags in Acc maker and removing frags in game.
If you kill someone on a guild war you will gain a normal frag o_O (Unjustifed kill) and counting frags in acc maker it's not working.
 
Last edited:
Back
Top