• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Bounty Hunters System (Player Hunt System)

Work at 0.3.4 corest but i have got a little error now with playerdeath.

Code:
[22/07/2009 14:13:54] data/creaturescripts/scripts/playerdeath.lua:onDeath

[22/07/2009 14:13:54] data/creaturescripts/scripts/playerdeath.lua:7: attempt to index global 'luasql' (a nil value)
[22/07/2009 14:13:54] stack traceback:
[22/07/2009 14:13:54] 	data/creaturescripts/scripts/playerdeath.lua:7: in function <data/creaturescripts/scripts/playerdeath.lua:3>

Anyone can fix it??
 
-- I'm using TFS 034-pl2 and when i'm use a command !hunt Player, Prize don't apear a HUNTED message and make a error on console... see that:
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/F@bio/bounty.lua:onSay

data/talkactions/scripts/F@bio/bounty.lua:13: attempt to concatenate global 'sp_
id' (a nil value)
stack traceback:
        data/talkactions/scripts/F@bio/bounty.lua:13: in function <data/talkacti
ons/scripts/F@bio/bounty.lua:1>
-- Can someone help me to fix this for work fine??? Thx for all to help me...
 
I have added 100% working NPC Punisher. He adds announcements instead of command!

Also there are some bugfixes, like person up.
 
Last edited:
@up
Liar, not working on 0.3.5 ;(.
When I say '!hunt 30, Tester' :
22:16 [BOUNTY HUNTERS] You haven't got enough money!
but I have 37!1!1

OH LOL XD. My fail, wait a second...

#
22:20 [BOUNTY HUNTERS] Hunt has been added!
Okok working :p. Thanks!!

##
Not working in 100% ;/.
on website showing this:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\bounty-hunters.php on line 45

###
okok sry for all ;d fixed.
Thanks and rep ;).
 
Last edited:
It's a piece of great job, I'm impressed. It would be worthless for me without the npc, because I keep my ots in rpg style, so talkactions like this would ruin the atmosphere.

But I have a little problem with him. He takes platinium coins from you, but the reward equals 100 crystal for each... An example.

I want to hunt "Zack" for "10". It should take 10 thousands but it takes 10 platinium coins. Then somebody kills Zack and gets the reward of 10 x 100cc... So, how do i fix it?
----
edit: Btw. It would be much better if the reward would be given to you by the npc. You know, after completing the errand you've to come back and collect the reward. I would appreciate if someone would upgrade npc script or give me some tips how to do it.
 
Last edited:
noooooooooooo why not tfs 0.2!! :(
 
I've rewrite this to mod system, but not work ;/. Help.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="BountyHunters" version="1.0" author="mateuszx and Renusek(mod)" contact="otland.net" enabled="yes">
	<description>
		By this mod you can really hunt another players. For kill hunted player, killer will get prize.
		You must say \"!hunt prize, nick\".
	</description>
	<event type="kill" name="BountyHunters" event="script"><![CDATA[				
	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
		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	
		_result = true
	end
]]></event>
	<talkaction words="!hunt" event="script"><![CDATA[
if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
		_result = 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).")
		_result = 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.")		
		_result = 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).")
		_result = true
	end
	
	if(prize >= 100000000000000000000) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] Sorry, you typed too big number!")
		_result = true
	end

	if is ~= 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] This player has already hunted.")	
		_result = 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
		
		
	_result = true
]]></talkaction>
</mod>
what's wrong?
 
I've rewrite this to mod system, but not work ;/. Help.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="BountyHunters" version="1.0" author="mateuszx and Renusek(mod)" contact="otland.net" enabled="yes">
	<description>
		By this mod you can really hunt another players. For kill hunted player, killer will get prize.
		You must say \"!hunt prize, nick\".
	</description>
	<event type="kill" name="BountyHunters" event="script"><![CDATA[				
	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
		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	
		_result = true
	end
]]></event>
	<talkaction words="!hunt" event="script"><![CDATA[
if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
		_result = 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).")
		_result = 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.")		
		_result = 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).")
		_result = true
	end
	
	if(prize >= 100000000000000000000) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] Sorry, you typed too big number!")
		_result = true
	end

	if is ~= 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] This player has already hunted.")	
		_result = 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
		
		
	_result = true
]]></talkaction>
</mod>
what's wrong?

event="script" => event="buffer" and registerCreatureEvent plx?
 
Last edited:
The mod written by me:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="BountyHunters" version="1.0" author="Masteuszx" contact="otibia.net" enabled="yes">
<description>
By this mod you can really hunt another players. For kill hunted player, killer will get prize.
You must say \"!hunt prize, nick\".
</description>
<event type="kill" name="BountyHunters" event="buffer"><![CDATA[
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
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
_result = true
end
]]></event>
<event type="login" name="BountyHuntersLogin" event="buffer"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "BountyHunters")
return TRUE
end
]]></event>
<talkaction words="!hunt" event="buffer"><![CDATA[
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
_result = 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).")
_result = 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.")
_result = 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).")
_result = true
end

if(prize >= 100000000000000000000) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] Sorry, you typed too big number!")
_result = true
end

if is ~= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTERS] This player is already hunted.")
_result = 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


_result = true
]]></talkaction>
</mod>

Tell me, is it works?
 
'; $inv = $SQL->query("SELECT * FROM `bounty_hunters` ORDER BY `added` DESC"); $num = 0; $color=$config['site']['darkborder']; while($tab = ($inv->fetch())){ if($num%2 == 0) {$color=$config['site']['darkborder'];} else {$color=$config['site']['lightborder'];} $hunted = $tab['player_name']; $hunted_by = $tab['hunted_by']; $killed_by = $tab['killed_by']; $prize = $tab['prize']/1000; $killed = $tab['kill_time']; $main_content .= ' '; $num++; } if($num == 0){ $main_content.=''; } $main_content .='

No idea, i've tried to copy the script again. I get this error in my dedicated host. When I tried at my own computer it worked fine, I don't know if it's any database config somewhere? :confused: And I also got the bounty_hunters in my database.
 
@2Up,
Lua:
-[./LUA] or PHP?
(No period)
 
Last edited:
Back
Top