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

TalkAction Bounty Hunters System (Player Hunt System)

good 1 i added it going to re-edit some stuff, i also didnt like the copyright there <_<, like , sure you make it but thats definetly not the way to get credits xD

anyways ty
 
is there no !bounty command, so you can see all guys with bounty on thier head
With the PHP file for a website.

Bounty Hunters on WWW
It will work on all Account makers

Create file bounty-hunters.php and paste inside:
Code:
   <?php
@mysql_connect("localhost","user","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>
            Wysyla ogloszenie o huncie dla postaci. Cena w tysiacach.<br>
            Przyklad: !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>Zlecil</B></center>
                </TD>
                <TD CLASS=white width=30%>
                    <center><B>Nagroda</B></center>
                </TD>
                <TD CLASS=white width=30%>
                    <center><B>Ofiara</B></center>
                </TD>
                <TD CLASS=white width=10%>
                    <center><B>Zabity przez</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>';
?>

After, open index.php and after:
PHP:
    case "guilds";
        $topic = "Guilds";
        $subtopic = "guilds";
        include("guilds.php");
    break;
paste this

PHP:
    case "bounty-hunters";
        $topic = "Bounty Hunters";
        $subtopic = "characters";
        include("bounty-hunters.php");
    break;

Open the file layout.php in layouts/tibiacom and then find:
Code:
<a href='index.php?subtopic=guilds'>
  <div id='submenu_guilds' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>

    <div id='ActiveSubmenuItemIcon_guilds' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Guilds</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>

and after add:
Code:
<a href='index.php?subtopic=bounty-hunters'>
  <div id='submenu_bounty' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>

    <div id='ActiveSubmenuItemIcon_biunty' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'>Bounty Hunters</div>
    <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
  </div>

And its all.
In first file you have to edit MySQL settings for connection!



WARNING! Bounty Hunter System will not work with SQLite! (only MySQL)
 
Got the database setup correctly?

Changed this in the PHP file:
Code:
@mysql_connect("localhost","user","password");
@mysql_select_db("database");
 
@masteuszx is there a way to make a command thats like !bountylist and it will show Everyonewho has a bounty, prize, and the person who put the bounty out ?
So example
!bountylist
Mastermind, 100000gp, Issued by Jill
 
case "guilds";$topic = "Guilds";$subtopic = "guilds";
include("guilds.php");
break;

this is not in my indes.php..

soo? whats next?
 
First, thank you for taking

Second, did everything right, but when I add a reward, not the site informs the player who is to be killed. how can I make when someone put a bounty, automatically add the website? already put the column of reward as your tutorial.

Another question, when someone uses the system! Hunt, no warning message appears in the global so that everyone knows what was added?

I'm waiting to finish the script :)
 
This is an awesome script...
Is there a way to add another talkaction like "!hunt remove" ?
Thanks!
 
Sorry for refresh but I've got an error with this script:
data/talkactions/scripts/bh-add.lua:43: attempt to index field 'db' (a nil value)

And here is the script:

Lua:
function onSay(cid, words, param)
if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
        return TRUE
    end
    local t = string.explode(param, ",")
    if(not t[2]) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
        return TRUE
    end
  
    local sp_id = getPlayerGUIDByName(t[2])
    if sp_id == nil then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] This player doesn't exists.")     
        return TRUE
    end
  
    local result_plr = db.getResult("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..sp_id.." AND `killed` = 0;")
    if(result_plr:getID() ~= -1) then
        is = tonumber(result_plr:getDataInt("sp_id"))
        result_plr:free()
    else
        is = 0
    end
    prize = tonumber(t[1])
    if(prize == nil or prize < 1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
        return TRUE
    end
  
    if(prize >= 100000000000000000000) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] Sorry, you typed too big number!")
        return TRUE
    end
    if is ~= 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] This player has already hunted.") 
        return TRUE
    end
  
        if doPlayerRemoveMoney(cid, prize*1000) == TRUE then
            db.db.executeQuery("INSERT INTO `bounty_hunters` VALUES (NULL,"..getPlayerGUID(cid)..","..sp_id..",0," .. os.time() .. ","..prize..",0,0);")
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] Hunt has been added!")        
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[HUNTED] You haven't got enough money!")       
        end
  
  
    return 1
end
 
Hi, I am using MyAAC and this part of the tutorial can't be completed since it doesn't match with my code in the Index.php:

PHP:
   case "guilds";

        $topic = "Guilds";

        $subtopic = "guilds";

        include("guilds.php");

    break;

---PLUS---

This part:

Lua:
registerCreatureEvent(cid, "PlayerDeath")

Couldn't find it anywhere so I just added it into my login.lua as it is supposed to be there and hope it doesn't give me an error (didn't compile yet the system...)

So my questions are:

-> Is anyone using MyAAC or knows how to find/add the "Bounty Hunter" menu tab in this AAC I am using so the .php takes effect in my website?
-> In case I have an error for adding that LUA code in the login.lua, anyone knows where should I allocate that code or find it?

THIS, is how my index.php shows me my code where it is supposed to insert the "Bounty Hunter" menu tab/option/button:
PHP:
            '/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
            '/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'),
            '/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2', 'page' => '$3'),
 
Back
Top