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

Bounty Hunter Script Fixed!

Fablow

Intermediate OT User
Content Editor
Joined
May 7, 2008
Messages
1,565
Solutions
6
Reaction score
145
Location
Canada
GitHub
Fablow77
PHP:
<?php
mysql_connect("localhost","root","password");
mysql_select_db("database");

$main_content .= '<P ALIGN=CENTER>
    <br>
    <FONT SIZE=5 COLOR=#CFF00C>
        How to use...
    </FONT>
    <br>
    <br>
    <FONT SIZE=2 COLOR=#CFF00C>
    * !hunt [prize],[nick] :
        <FONT SIZE=1 COLOR=#FCC33F>
            Sends an announcement about huncie to form. Price in thousands.<br>
            Example: !hunt 100,Infinity
        </FONT><br>
    </FONT>
</P>
<br>
<br>
    <center>
        <h1>
            Bounty Hunters
        </h1>
    </center>
        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
            <TR BGCOLOR="#505050">
                <TD CLASS=white width=30%>
                    <center><B>Commissioned</B></center>
                </TD>
                <TD CLASS=white width=30%>
                    <center><B>Award</B></center>
                </TD>
                <TD CLASS=white width=30%>
                    <center><B>Offer</B></center>
                </TD>
                <TD CLASS=white width=10%>
                    <center><B>Killed By</B></center>
                </TD>
            </TR>';
 $inv = mysql_query("SELECT * FROM `bounty_hunters` ORDER BY `added` DESC");
$num = 0;
$color=$config['site']['darkborder'];
while($tab = mysql_fetch_array($inv)){
if($num%2 == 0){$color=$config['site']['darkborder'];}else{$color=$config['site']['lightborder'];}
$pid = $tab['fp_id'];
$sid = $tab['sp_id'];
$kid = $tab['k_id'];
$killed = $tab['killed'];
$prize = $tab['prize']*1000;
if($killed == 0){
$kill = '<font color="red">Nobody!</font>';
}else{
$k = mysql_query("SELECT * FROM `players` WHERE `id` = ".$kid."");
$k1 = mysql_fetch_array($k);
$kill_name = $k1['name'];
$kill = '<a href="index.php?subtopic=characters&name='.$kill_name.'">'.$kill_name.'</a>';
}
$f = mysql_query("SELECT * FROM `players` WHERE `id` = ".$pid."");
$f1 = mysql_fetch_array($f);
$s = mysql_query("SELECT * FROM `players` WHERE `id` = ".$sid."");
$s1 = mysql_fetch_array($s);
$fn = $f1['name'];
$sn = $s1['name'];

$main_content .= '
        <TR BGCOLOR="'.$color.'">
            <TD>
                <center>
                    <b>
                        <a href="index.php?subtopic=characters&name='.$fn.'">'.$fn.'</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        '.$prize.' gp
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        <a href="index.php?subtopic=characters&name='.$sn.'">'.$sn.'</a>
                    </b>
                </center>
            </TD>
            <TD>
                <center>
                    <b>
                        '.$kill.'
                    </b>
                </center>
            </TD>
        </TR>';
$num++;
}
if($num == 0){
        $main_content.='<TR BGCOLOR="'.$color.'">
            <TD colspan=4>
                <center>
                    Currently there are not any bounty hunter offer.
                </center>
            </TD>
        </TR>';
}
        $main_content .='</TABLE><div align="right">Copyright &copy; <a href="http://otibia.net">oTibia.net</a>.</div>';
?>

When i tried to use the one that mateusz (spelling?) I had problems with the script, so heres the fixed version.
 
Last edited:
Nice.

Repp for you:peace:

Edit:You must spread some Reputation around before giving it to Assassin Legend again.
 
PHP:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\bounty.php on line 45
 
Much easier to make a config in the beginning instead of doing it in that way, that'll be much more comfortable for beginners.

I'm talking about
PHP:
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "password";
$db = "database";

// Then when we come to this part, it'll connect to the database using your config and you won't need to edit this part.
connect_mysql($dbhost, $dbuser, $dbpass)or die(mysql_error());

/Nikkster
 
@UP
Mmhk. You gotta be pure noob not to get it.

@Orkhz
Did you fill in your database information?
 
Yes I did. How can I fix it?
 
Last edited:
It is good that you fixed a (small) bug. But still it is badly written, not only this. But also the luascripts need a complete revamp.

I have a part revamped, but it is not yet ready to be released. It needs to be tested first.:p

Please note that this wasn't meant to insult or make you feel bad in any way. You didn't write the script, just solved the bug so it works now. Thats a good job and I hope you continue doing that:).
 
Much easier to make a config in the beginning instead of doing it in that way, that'll be much more comfortable for beginners.

I'm talking about
PHP:
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "password";
$db = "database";

// Then when we come to this part, it'll connect to the database using your config and you won't need to edit this part.
connect_mysql($dbhost, $dbuser, $dbpass)or die(mysql_error());

/Nikkster
Fail.. are you Nikkster, lol.
connect_mysql?
It's called mysql_connect :) Dont acll yourself C++, PHP Programmer.
 
@Master-m

Ye i know, but alot of noobies always bug everyone and shit, so i just posted my "fixed" version.

Im learning.. :p
 
Why you can't use "foreach" ?

PL version:
Popierdoliło Cię? Od tego jest foreach a nie while... Wyszło by w chuj krócej.
 
Why you can't use "foreach" ?

PL version:
Popierdoliło Cię? Od tego jest foreach a nie while... Wyszło by w chuj krócej.

Why won't u just post shortened version instead of blaming some1 ?
 
Back
Top