samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 608
- Solutions
- 4
- Reaction score
- 120
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
I choose the price of the hunt, for example, 1kk. I kill a player with another character; the player doesn't leave the hunt list and doesn't receive a reward, in this case, 1kk.
xtibia.com
!hunt
creaturescripts
talkactions
@edit chatgpt
Hunted System
E aí galera, vim apresentar o hunted system, é um sistema que consiste em um "caçador de recompensa", você diz "!hunt Nome do Player,quantidade de dinheiro" e então o player definido fica hunted para o servidor todo e quem mata-lo ganha a quantia de dinheiro que você ofereceu ( o dinheiro é desco...
!hunt
LUA:
Hunteds Online:
- Forth [1000000 golds];
Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if not isPlayer(cid) then
return true
end
local rewardGols = getPlayerStorageValue(cid, 201310251658)
if rewardGols <= 0 then
return true
end
if not isPlayer(lastHitKiller) then
return true
end
-- Zera o storage do hunted antes de pagar
setPlayerStorageValue(cid, 201310251658, -1)
-- Configuração: escolha a moeda que será paga
-- IDs e valores das moedas
local rewardCoinId = 2160 -- padrão Crystal Coin
local coinWorths = {
[2148] = 1, -- Gold Coin
[2152] = 100, -- Platinum Coin
[2160] = 10000, -- Crystal Coin
[2157] = 10000000, -- KK Coin
[9971] = 1000000000, -- VIP Coin
[2159] = 100000000000 -- Donate Coin
}
local coinWorth = coinWorths[rewardCoinId] or 1
local amount = math.floor(rewardGols / coinWorth)
if amount < 1 then
amount = 1
end
-- Dá os coins para o hunter
doPlayerAddItem(lastHitKiller, rewardCoinId, amount)
-- Mensagens
doBroadcastMessage("[Hunted System] ["..getCreatureName(lastHitKiller).."] fulfilled the contract on ["..getCreatureName(cid).."] and received ["..amount.."] ".. getItemNameById(rewardCoinId) ..".", MESSAGE_STATUS_CONSOLE_RED)
doPlayerSendTextMessage(lastHitKiller, MESSAGE_INFO_DESCR, "[Hunted System] You fulfilled the contract on ["..getCreatureName(cid).."] and received ["..amount.."] ".. getItemNameById(rewardCoinId) ..".")
return true
end
talkactions
Code:
function onSay(cid, words, param)
local maxReward = 1000000000 -- Limite máximo do contrato em golds
local str = string.explode(param, ",")
if not str[1] then
doShowTextDialog(cid, 2366, huntedsOnline())
return true
end
local hunt = getPlayerByNameWildcard(string.lower(str[1]))
if (not isPlayer(hunt)) then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] This player does not exist or is not online.")
end
if (cid == hunt) then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] Sorry but you can not put a contract on yourself.")
end
if (getPlayerAccess(hunt) >= 3) then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] You can not put a contract on this player.")
end
if (not str[2]) or (not isNumber(str[2])) then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] Enter amount of golds that will be paid.")
end
if (getPlayerStorageValue(hunt, 201310251658) >= 1) then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] Can not perform this operation. The chosen player already has contracts.")
end
local reward = tonumber(str[2])
if reward > maxReward then
reward = maxReward
end
if getPlayerMoney(cid) < reward then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] You do not have enough money. You have ["..getPlayerMoney(cid).."] golds, trying to pay ["..reward.."] golds. Max reward is ["..tostring(maxReward).."] golds.")
end
-- Remove o dinheiro e seta o storage
doPlayerRemoveMoney(cid, reward)
setPlayerStorageValue(hunt, 201310251658, reward)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] You have created a contract of reward for the player ["..str[1].."] by ["..tostring(reward).."] golds.")
doBroadcastMessage("[Hunted System] "..getCreatureName(cid).." created a contract to kill the player ["..str[1].."] by ["..tostring(reward).."] golds.", MESSAGE_STATUS_CONSOLE_RED)
return true
end
function huntedsOnline()
local str = "Hunteds Online:\n\n"
local hunts = checkHunt()
if #hunts == 0 then
return "There are no contracts online.\n\n"
end
for _, a in ipairs(hunts) do
str = str.." - "..getCreatureName(a).." ["..tostring(getPlayerStorageValue(a, 201310251658)).." golds];\n"
end
return str
end
function checkHunt()
local hunteds = {}
for _, b in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(b, 201310251658) ~= -1 then
table.insert(hunteds, b)
end
end
return hunteds
end
@edit chatgpt