Autor :Infinity z oTibia.net [[http://otland.net/f81/bounty-hunters-system-player-hunt-system-27721/|klik]] Licencja : Rób co chcesz byle by nie zmieniać autora Skrypt działa na zasadzie gdy gracz **x** został zabity przez gracza **y** (zdenerwował sie bo ma dużo mniejszy level niż gracz **y**) ma on dużo pieniędzy wiec zamawia hunta graczowi **y**. Za jego głowę płaci 100k. Gracz **z** zabija gracza **y** i otrzymuje nagrodę w wysokości 100k. Teraz konkrety: ** Część SQL ** 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; ** Część LUA ** Wchodzimy do katalogu /data/talkactions/scripts/ tworzymy plik bh-add.lua dodajemy do niego: function onSay(cid, words, param) if(param == "") then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] 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, "[BOUNTY HUNTERS] 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, "[BOUNTY HUNTERS] 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, "[BOUNTY HUNTERS] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).") return TRUE end if(prize >= 100000000000000000000) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] Sorry, you typed too big number!") return TRUE end if is ~= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] This player has already hunted.") return TRUE end if doPlayerRemoveMoney(cid, prize*1000) == 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_BLUE, "[BOUNTY HUNTERS] Hunt has been added!") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] You haven't got enough money!") end return 1 end Następnie wchodzimy do katalogu /data/talkactions/talkactions.xml/ i dodajemy linijkę: Kolejnym krokiem jest wejście do katalogu data/creaturescript/creaturescripts.xml i dodanie linijki: Następnie data/creaturescripts/scripts/ otwieramy plik login.lua i dodajemy tam linijkę: POD LINIJKA! registerCreatureEvent(cid, "PlayerDeath") DODAC TO registerCreatureEvent(cid, "BountyHunter") Zostajemy w katalogu data/creaturescripts/scripts/ i tworzymy plik kill.lua wklejamy do niego: function onKill(cid, target) if isPlayer(target) == TRUE then ---- BOUNTY HUNTERS START ----- 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*1000) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[BOUNTY HUNTERS] You killed hunted player, so you gained the reward!') end ---- BOUNTY HUNTERS END ----- end return TRUE end **Część PHP** Tworzymy plik bounty-hunters.php w katalogu z naszym acc makerem.
How to use...

* !hunt [prize],[nick] : Wysyla ogloszenie o huncie dla postaci. Cena w tysiacach.
Przyklad: !hunt 100,Infinity



Bounty Hunters

'; $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 = 'Nobody!'; }else{ $k = @mysql_query("SELECT * FROM `players` WHERE `id` = ".$kid.""); $k1 = @mysql_fetch_array($k); $kill_name = $k1['name']; $kill = ''.$kill_name.''; } $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 .= ' '; $num++; } if($num == 0){ $main_content.=''; } $main_content .='
Zlecil
Nagroda
Ofiara
Zabity przez
'.$fn.'
'.$prize.' gp
'.$sn.'
'.$kill.'
Currently there are not any bounty hunter offer.
Copyright © oTibia.net.
'; ?>
Teraz dodajemy to do naszego index.php : POD case "guilds"; $topic = "Guilds"; $subtopic = "guilds"; include("guilds.php"); break; WKLEJAMY TO case "bounty-hunters"; $topic = "Bounty Hunters"; $subtopic = "characters"; include("bounty-hunters.php"); break; To dodajemy do naszego layouta jeśli używamy tibiacom layout: ==== PAMIETAJ! SYSTEM NIE DZIAŁA W SQLite TYLKO MySQL! ====