Bounties by KyleMassacre

General Chat, Comments

Bounties by KyleMassacre

Postby cbsarge » Fri Jul 22, 2016 1:29 pm

Hi Kyle,

I hope you see this. I thought it might be fun to add a home page element to your Bounties module. I've got what I think should be a working version of it except I decided to go off the reservation and add avatars to the listing on the home page. Now after refreshing the Home page a few times it logs me out of the game.

Any thoughts on why this might be happening? I seem to remember a similar behavior when I tried adding the avatars to the player listing but, had abandoned trying to fix it then.

Any help would be greatly appreciated!

home.php
Code: Select all
<?php
TableHeader("Available Bounties");
echo Translate("Make some quick cash or put the hit out on someone!")."<br>";
echo Translate("Try to collect one of these contracts or head over to the Bounties Office and take out your own!");
echo "<center>";
$result = $db->Execute("select bounty_id,bounty_userid,bounty_adder,bounty_price,bounty_start,bounty_private,bounty_inAction from bounty_list");
{
   echo "<table class='plainTable'>";
   echo "<tr class='titleLine'>";
   echo "<td>" . Translate("#"). "</td>";
   echo "<td>" . str_replace(" ", "&nbsp;", Translate("Victim")). "</td>";
   echo "<td>" . str_replace(" ", "&nbsp;", Translate("Mug Shot")). "</td>";
   echo "<td>" . str_replace(" ", "&nbsp;", Translate("Bounty Price")) . "</td>";
   echo "<td>" . str_replace(" ", "&nbsp;", Translate("Bounty Owner")) . "</td>";
   echo "<td>" . str_replace(" ", "&nbsp;", Translate("Bounty Actions")). "</td>";
   echo "</tr>";
   $row = 0;
   if($result->EOF)
      echo "<tr class='evenLine'><td colspan='100%' align='center'><strong>No bounties to display</strong></td></tr>";
   else
   {
      while (!$result->EOF)
      {
          if ($row % 2 == 0)
              echo "<tr class='evenLine'>";
          else
              echo "<tr class='oddLine'>";
           $row ++;
           $a = $db->Execute("select id, username from users where id = ?",$result->fields[2]);
           $b = $db->Execute("select id, username from users where id = ?",$result->fields[1]);
         $avatarb = $db->Execute("select id from users where id = ?",$result->fields[1]);
           if($result->fields[5] == "un-listed")
           {
              if($result->fields[2] == $userId)
                 $adder = $a->fields[1]. "<em>(Private)</em>";
              else
               $adder = "<em>Private</em>";
         }
         else
            $adder = "<a href='index.php?p=view_player&id=".$a->fields[0]."'>".$a->fields[1]."</a>";
           echo "<td>".$row.".</td>";
         echo "<td><a href='index.php?p=view_player&id=".$b->fields[0]."'>".$b->fields[1]."</td>";
         echo "<td>";
         DisplayAvatar($avatarb->fields[0]);
         echo "</td>";
         echo "<td>".FormatNumber($result->fields[3]).str_replace("","&nbsp",Translate(" !Currency"))."</td>";
         echo "<td>".$adder."</td>";
         echo "<td>";
         if  ($result->fields[2] == $userId)
            LinkButton("Cancel Bounty","index.php?p=bounties&action=cancel&id={$result->fields[0]}");
         else
            LinkButton("Claim Bounty","index.php?p=bounties&action=claim&id={$result->fields[0]}");
         echo "</td>";
         $result->MoveNext();
      }
   $result->Close();
   }
   echo "</tr>";
   echo "</table>";

}
LinkButton("Bounties Office","index.php?p=bounties");
echo "</center>";
tableFooter();
echo "<br>";
User avatar
cbsarge
 
Posts: 179
Joined: Mon Sep 14, 2015 10:20 am
Has thanked: 42 times
Been thanked: 1 time

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x