yes much players don't check the bounty page so the broadcast should work as a reminder
function onThink(interval)
local player = db.storeQuery("SELECT `sp_id`, `prize` FROM `bounty_hunters` WHERE `killed` = '0' ORDER BY `prize` DESC LIMIT 3;")
local output = "MOST WANTED:\n"
if(player ~= false) then
local number = 1
while (true) do
local name = result.getDataString(player, "sp_id")
local prize = result.getDataInt(player, "prize")
local playerName = db.storeQuery("SELECT `name` FROM `players` WHERE `players`.`id` = "..name..";")
local playerName1 = result.getDataString(playerName, "name")
output = output.. "\n"..number..". "..playerName1.." - "..prize.."k"
number = number + 1
if not(result.next(player)) then
break
end
end
result.free(player)
end
Game.broadcastMessage(output)
return true
end
<globalevent name="bounty" interval="3600000" script="bounty.lua"/>
When i kill the "hunt" player, i dont any gold. And on website he are still "still alive"
function onKill(cid, target)
local player2 = Creature(target)
if not player2:isPlayer() then
return true
end
---- BOUNTY HUNTERS START -----
pid = cid
pid2 = player2:getGuid()
local result_plr = db.storeQuery("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..pid2.." AND `killed` = 0;")
if(result_plr ~= false) then
prize = tonumber(result.getDataInt(result_plr, "prize"))
bid = tonumber(result.getDataInt(result_plr, "id"))
result.free(result_plr)
else
prize = 0
bid = 0
end
if (bid ~= 0 and prize ~= 0 and not(getTileInfo(getCreaturePosition(cid)).pvp)) then
local player = Player(cid)
db.query("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")
player:setBankBalance(player:getBankBalance() + prize)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,'[BOUNTY HUNTERS] You killed hunted player, so you gained the reward!')
Game.broadcastMessage("Bounty Hunter Update:\n " .. player:getName() .. " has killed " .. player2:getName() .. " and earned the prize of " .. prize .. " gps!", MESSAGE_EVENT_ADVANCE)
end
---- BOUNTY HUNTERS END -----
return true
end
$b = round($bounty[prize] / 1000000,2);
$b = round($bounty[prize] / 1000,2);
Let me know if you get any errors. The gold is added to the players bank account, not his backpack.
what tfs r u using?I got this one onDeath
TFS 1.1 http://nightlies.otland.net/ x64-Debug.exe as it's the only one I get to work without crashes. My own-compiled one crashes after about 5 minutes.what tfs r u using?
changeTFS 1.1 http://nightlies.otland.net/ x64-Debug.exe as it's the only one I get to work without crashes. My own-compiled one crashes after about 5 minutes.
if (bid ~= 0 and prize ~= 0 and not(getTileInfo(getCreaturePosition(cid)).pvp)) then
db.query("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")
if (bid ~= 0 and prize ~= 0 and (not creature:getTile():hasFlag(TILESTATE_PVPZONE))) then
db.query("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..creature:getGuid()..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")
I got this one onDeath
Nope I'm using the one you posted on this page ^ up there. Because I had the same problem as giddy92.Are you sure your using the script from the first post? I don't see a getCreaturePosition on line 19 in the bh-kill script.
This is why there needs to be a standardized aac which utilizes an api similar to Joomla..Anyone end up making a Znote Version of the Php for this?
This is why there needs to be a standardized aac which utilizes an api similar to Joomla..
https://api.joomla.org/cms-3/index.html
Then there will be less questions like "is it compatible with x"
A simple talkaction in-game to see the hunted players and their price would be great as well.
Kind Regards,
Eldin
<talkaction words="!hunted" separator=" " script="test/bounthunter_check.lua" />
local config = {
dialogBoxImageId = 24560, -- change this ID to the image you want to see on the Dialog Box
delay = true, -- Would you like to add a delay on this talkaction?
delayTime = 30, -- time in seconds you would like to add a delay on the talkaction
delayStorage = 60799 -- empty storage value
}
function onSay(cid, words, param)
local player = Player(cid)
if config.delay and player:getStorageValue(config.delayStorage) > os.time() then
player:sendCancelMessage('Please wait another ' .. (player:getStorageValue(config.delayStorage) - os.time()) .. ' seconds before you try the command again.')
return false
end
local huntedPlayers = db.storeQuery("SELECT `sp_id`, `prize` FROM `bounty_hunters` WHERE `killed` = '0' ORDER BY `prize` DESC;")
local output = "MOST WANTED:\n"
if(huntedPlayers ~= false) then
local number = 1
while (true) do
local id = result.getDataInt(huntedPlayers, "sp_id")
local prize = result.getDataInt(huntedPlayers, "prize")
local playerName = db.storeQuery("SELECT `name`,`level` FROM `players` WHERE `id` = "..id..";")
if playerName then
local playerName1 = result.getDataString(playerName, "name")
local level = result.getDataInt(playerName, "level")
output = output .. "\n" .. number .. ". " .. playerName1 .. " [" .. level .. "] --- " .. prize .. "gps"
number = number + 1
end
if not(result.next(huntedPlayers)) then
break
end
end
result.free(huntedPlayers)
end
player:showTextDialog(config.dialogBoxImageId, output)
if config.delay then
player:setStorageValue(config.delayStorage, os.time() + config.delayTime)
end
return false
end