1
[Sistema] Bounty Hunters (Compatible con OTx alls protocolos tfs 0.3.7) Jue Ago 20, 2015 2:17 pm
[Admin] God Maya
![[Admin] God Maya](https://2img.net/u/2712/30/40/04/avatars/1-92.jpg)
Administrador

bueno aqui le straigo el famoso Bounty Hunters trata.
Si yo Maya quiero ofrece 10cc por matar a un player abuser, y si lo matan supongamos el player "Vengador" a el le dan los 10cc.
en pocas palabras el que mata al player hunteado obvio el que gana la frag gana los cc.
![[Sistema] Bounty Hunters (Compatible con OTx alls protocolos tfs 0.3.7) Captur23](https://i.servimg.com/u/f18/18/67/75/58/captur23.jpg)
![[Sistema] Bounty Hunters (Compatible con OTx alls protocolos tfs 0.3.7) Captur24](https://i.servimg.com/u/f18/18/67/75/58/captur24.jpg)
en esta imagen si tengo pk red es porque yo mate a aquel personaje 3 veces injustas testeando el sistema jejejej lo siento no se asusten el sistema esta bien no da pk red.
y como ven la recompensa es automatica.
![[Sistema] Bounty Hunters (Compatible con OTx alls protocolos tfs 0.3.7) Captur26](https://i.servimg.com/u/f18/18/67/75/58/captur26.jpg)
y aqui el resultado como se ve en la pagina.
![[Sistema] Bounty Hunters (Compatible con OTx alls protocolos tfs 0.3.7) Captur27](https://i.servimg.com/u/f18/18/67/75/58/captur27.jpg)
instalacion:
En nuestra base de datos mysql ejecutamos esta tabla:
- Código:
CREATE TABLE IF NOT EXISTS `bounty_hunters` (
`id` int(11) NOT NULL auto_increment,
`fp_id` int(11) NOT NULL,
`sp_id` int(11) NOT NULL,
`k_id` int(11) NOT NULL,
`added` int(15) NOT NULL,
`prize` bigint(20) NOT NULL,
`killed` int(11) NOT NULL,
`kill_time` int(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Vamos a nuestra carpeta htdocs
copiamos cualquier archivo html y renombramos por bounty-hunters.php y pegamos esto dentro
- Código:
<?php
@mysql_connect("127.0.0.1","root","contraseña");
@mysql_select_db("nombre de base de datos");
$main_content .= '<P ALIGN=CENTER>
<br>
<FONT SIZE=5 COLOR=#5A2800>
Como usar el Player Hunt System...
</FONT>
<br>
<br>
<FONT SIZE=2 COLOR=#5A2800>
* !hunt [precio],[nombre] :
<FONT SIZE=1 COLOR=#5A2800>
Envia el anuncion con el nombre y el dinero Ofrecido.<br>
Ejemplo: !hunt 100,Maya
</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>Hunteador</B></center>
</TD>
<TD CLASS=white width=30%>
<center><B>Recompensa</B></center>
</TD>
<TD CLASS=white width=30%>
<center><B>Hunteado</B></center>
</TD>
<TD CLASS=white width=10%>
<center><B>Vengador</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 <a href="http://www.tibiaface.com/">tibiaface</a></div>';
?>
configurar:
- Código:
mysql_connect("127.0.0.1","root","contraseña");
mysql_select_db("nombre de base de datos");
127.0.0.1: 127.0.0.1
root: usuario de su phpadmin por lo general es root
contraseña: contraseña de su phpadmin
nombre de base de datos: nombre de su database creada
Ahora abrimos el fichero "index.php" y agregamos esta linea (Este codigo esta para el layout de tibiacom)
- Código:
case "bountyhunters";
$topic = "Bounty Hunters";
$subtopic = "bountyhunters";
include("bounty-hunters.php");
break;
Abrimos el fichero layout.php de nuestro layout y agregamos esto
- Código:
<a href='?subtopic=bountyhunters'>
<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_guilds' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
<div class='SubmenuitemLabel'>Player Hunt</div>
<div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
</div>
</a>
Ahora nos vamos a:
data\creaturescripts\scripts |
- Código:
function onKill(cid, target)
if isPlayer(target) == TRUE then
pid = cid
pid2 = getPlayerGUID(target)
local result_plr = db.getResult("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..pid2.." AND `killed` = 0;")
if(result_plr:getID() ~= -1) then
prize = tonumber(result_plr:getDataInt("prize"))
bid = tonumber(result_plr:getDataInt("id"))
result_plr:free()
else
prize = 0
bid = 0
end
if (bid ~= 0 and prize ~= 0 and not(getTileInfo(getCreaturePosition(cid)).pvp)) then
db.executeQuery("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")
doPlayerAddMoney(cid,prize)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"[Bounty System]: You killed "..getPlayerName(target).."! You gained the bounty that was put on his/her head!")
doSendMagicEffect(getCreaturePosition(cid), 27)
doBroadcastMessage("[Bounty System]: "..getPlayerName(cid).." killed "..getPlayerName(target).." and gained the bounty! ("..prize.." gold)", MESSAGE_EVENT_ADVANCE)
end
end
return TRUE
end
En la misma carpeta buscamos el archivo login.lua y agregamos esta linea:
- Código:
registerCreatureEvent(cid, "Bounty")
ahora nos vamos a:
data\creaturescripts\creaturescripts.xml |
- Código:
<event type="kill" name="Bounty" event="script" value="bounty.lua"/>
Ahora nos vamos a:
Data/talkactions/scripts |
- Código:
function onSay(cid, words, param)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Bounty System]: Usage: "!bounty [gold],[nick]" where gold is at least 10000.")
return TRUE
end
local t = string.explode(param, ",")
if(not t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Bounty System]: Usage: "!bounty [gold],[nick]" where gold is at least 10000.")
return TRUE
end
local sp_id = getPlayerGUIDByName(t[2])
if sp_id == nil then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Bounty System]: You cant put a bounty on imaginary people, your target doesn't exist.")
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 < 10000) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Bounty System]: Usage: "!bounty [gold],[nick]" where gold is at least 10000.")
return TRUE
end
if(prize >= 999999999) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Bounty System]: Sorry, bounty limit is at 999.9 million gold!")
return TRUE
end if is ~= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "[Bounty System]: "..t[2].." has already got a bounty on his/her head.")
return TRUE
end
if doPlayerRemoveMoney(cid, prize) == TRUE then
db.executeQuery("INSERT INTO `bounty_hunters` VALUES (NULL,"..getPlayerGUID(cid)..","..sp_id..",0," .. os.time() .. ","..prize..",0,0);")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "[Bounty System]: Bounty on "..t[2].."s head has been added successfully!")
doBroadcastMessage("[Bounty System]: A bounty of "..prize.." gold for "..t[2].."s head has been submitted by "..getPlayerName(cid)..". The first one to kill "..t[2].." will get the gold!", MESSAGE_EVENT_ADVANCE)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Bounty System]: You dont have enough gold!")
end
return 1
end
Luego nos vamos a:
Data/talkactions/talkactions.xml |
- Código:
<talkaction words="/bounty;!bounty;!hunt;/hunt" script="tbounty.lua" />
Nota: la recompensa es automatica al momento de que el player mata al player huteado se le añadira la recompensa.
Creditos: al creador del script:
Última edición por [Admin] God Maya el Miér Abr 12, 2017 12:14 am, editado 1 vez

![[Sistema] Bounty Hunters (Compatible con OTx alls protocolos tfs 0.3.7) YNU5B25](https://i.imgur.com/yNU5B25.png)