Ir para conteúdo

Hunted System


Posts Recomendados

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 é descontado do seu char)..

 

Fotos:

 

 

1501676_686332694757978_726320369_n.png

 

 

 

Diga !hunt para saber os players hunted online... Vou parar de falar e ir ao sistema!

 

Em talkactions/scripts crie um arquivo lua e coloque isso dentro:

function onSay(cid, words, param)
local multiplier = 10000
    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
    
    local formula = (getPlayerLevel(hunt) * 10 / 50 * multiplier)
    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 in 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

if (getPlayerMoney(cid) < tonumber(str[2])) or (tonumber(str[2]) < formula) then
     return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] You do not have enough money. For the player ["..str[1].."], you need pay ["..tostring(formula).."] or more golds.")
    end

doPlayerRemoveMoney(cid, str[2])
    setPlayerStorageValue(hunt, 201310251658, str[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Hunted System] You have created a contract of reward for the player ["..str[1].."] by ["..tostring(str[2]).."] golds.")
doBroadcastMessage("[Hunted System] "..getCreatureName(cid).." created a contract to kill the player ["..str[1].."] by ["..tostring(str[2]).."] golds.", MESSAGE_STATUS_CONSOLE_RED)
return true
end

function huntedsOnline()
    local str = "Hunteds Online:\n\n"

    for _, a in ipairs(checkHunt()) do
        if #checkHunt() > 0 then
         str = ""..str.." - "..getCreatureName(a).." ["..tostring(getPlayerStorageValue(a, 201310251658)).." golds];\n"
        else
         str = "There are no contracts online.\n\n"
        end
    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 or #hunteds
end

em talkactions.xml coloque:

<talkaction words="!hunt" event="script" value="b_hunterTalk.lua"/>

Em creaturescripts/scripts coloque:

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
local golds = getPlayerStorageValue(cid, 201310251658)

if getTileInfo(getThingPos(cid)).nologout then
return true
end

    if (not isPlayer(cid)) or (not isPlayer(lastHitKiller[1])) then
        return true
    end

    if golds > 0 then

    setPlayerStorageValue(cid, 201310251658, -1)
    doPlayerAddMoney(lastHitKiller[1], tonumber(golds))
    doBroadcastMessage("[Hunted System] ["..getCreatureName(lastHitKiller[1]).."] fulfilled in ["..getCreatureName(cid).."] the contract and received ["..tostring(golds).."] golds.", MESSAGE_STATUS_CONSOLE_RED)
    doPlayerSendTextMessage(lastHitKiller[1], 20, "[Hunted System] "..getCreatureName(lastHitKiller[1]).." fulfilled in ["..getCreatureName(cid).."] the contract and received a reward of ["..tostring(golds).."] golds.")
    return true
end

    return true
end

e em creaturescripts.xml coloque:

<event type="preparedeath" name="b_hunterKill" event="script" value="b_hunterKill.lua"/>

Existe uma quantia mínima dependendo do level do player. Existe um sistema parecido só que é por NPC, achei mais legal essa por talkaction. Esse sistema é exclusivo do Global War, feito pelo scripter Roksas e sendo liberado por mim (Keilost).

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...