the website script is safe?
As far i have tested: yes...
the website script is safe?
<talkaction words="!hunted" script="hunted.lua"/>
function onSay(cid, words, param)
local player = db.getResult("SELECT `sp_id`, `prize` FROM `bounty_hunters` WHERE `killed` = '0' ORDER BY `prize` DESC LIMIT 50;")
local output = "MOST WANTED:\n"
if(player:getID() ~= -1) then
local number = 1
while (true) do
local name = player:getDataString("sp_id")
local prize = player:getDataInt("prize")
output = output.. "\n"..number..". "..getPlayerNameByGUID(name).." - "..prize.."k"
number = number + 1
if not(player:next()) then
break
end
end
player:free()
end
doShowTextDialog(cid, 5958, output)
return TRUE
end
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
print(bid)
print(prize)
if (bid ~= 0 and prize ~= 0 and getTileInfo(getCreaturePosition(cid)).pvp ~= true) then
db.executeQuery("DELETE FROM `bounty_hunters` 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
For those who don't want to use website it may be useful.
add in talkactions.xml:
create file hunted.lua and paste:Code:<talkaction words="!hunted" script="hunted.lua"/>
Rep me if it's helpfulCode:function onSay(cid, words, param) local player = db.getResult("SELECT `sp_id`, `prize` FROM `bounty_hunters` WHERE `killed` = '0' ORDER BY `prize` DESC LIMIT 50;") local output = "MOST WANTED:\n" if(player:getID() ~= -1) then local number = 1 while (true) do local name = player:getDataString("sp_id") local prize = player:getDataInt("prize") output = output.. "\n"..number..". "..getPlayerNameByGUID(name).." - "..prize.."k" number = number + 1 if not(player:next()) then break end end player:free() end doShowTextDialog(cid, 5958, output) return TRUE end
@topic: Creaturescript doesn't work for meANyone know what's wrong with it ? (TFS 0.3.3)
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Documents and Settings\Admin\Desktop\OT\xampplite\htdocs\bounty-hunters.php on line 44
still doesn't work. There's no error, i'm using 0.3.3, and script seems not to be executed...
Yes it is...
@Raliuga
This script is posted on the first page ?
[only tfs 0.3+ versions]
i'll add this feature to my acc. Maker or something better (my php/lua scripts - work with sqlite, optimized)![]()
NO I didn't change anything.I put everything in the right place I think... Any suggestions ?
yes you did it! or... are you saying that you confuse numbers? (3!=2)
Any idea? Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\~\bounty-hunters.php on line 44.
Really I did everything right. Using TFS 0.3+ and Gesior's account manager.
while($tab = mysql_fetch_array($inv)){
$inv = mysql_query("SELECT * FROM `bounty_hunters` ORDER BY `added` DESC");
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` int(11) 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;