Ir para conteúdo

Featured Replies

Postado
23 horas atrás, ADM Mayk on BaiakME disse:

até funcionou porem aparece esse erro é desliga o server sozinho

image.png.07aabcaec067722d8f0982eaf9f377c9.png

 

o erro acontece quando eu clicko na backpack pra pega a premiação 

não teria como tirar a backpack ? exemplo clicka no bau é já recebe os items sem precisa de backpack

 

local t = {
    backpack_id = 1988, -- id da backpack
    experience = 1000, -- quantidade de experiência adicionada
    effect = CONST_ME_FIREAREA, -- efeito
    msg = "Congratulations! You have received your reward.", -- mensagem
    time_to_get_again = {24, "hour"},  -- tempo para poder abrir novamente, use 'sec', 'min', 'hour', 'day'
    storage = 78660, -- só modifique se necessário
    voc_items = {
        [{1,2}] = {{1111, 10}, {2222, 3}}, -- [{ids das vocações}] = {id do item, quantidade}
        [{3,4}] = {{1111, 10}, {2222, 3}},
        [{5,6}] = {{1111, 10}, {2222, 3}}
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, t.storage) > os.time() then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You can take the reward again at "..os.date("%d %B %Y %X", getPlayerStorageValue(cid, t.storage))..".")
        return true 
    end
    local tab = {}
    for voc_tab, items in pairs(t.voc_items) do
        if isInArray(voc_tab, getPlayerVocation(cid)) then
            tab = items
            break
        end
    end
    if #tab == 0 then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Your vocation is not allowed to get the reward.")
        return true
    end
    local bp = doCreateItemEx(t.backpack_id, 1)
    for i = 1, #tab do
        local id, count = tab[i][1], tab[i][2]
        if isItemStackable(id) then
            doAddContainerItem(bp, id, count)
        else
            for k = 1, count do
                doAddContainerItem(bp, id, 1)
            end
        end
    end
    local bpWeight = getItemWeight(bp)
    if getPlayerFreeCap(cid) < bpWeight then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have found a " .. getItemNameById(t.backpack_id) .. " weighing " .. bpWeight .. " oz it\'s too heavy.")
        return true
    end
    local p = getPlayerPosition(cid)
    if getPlayerStorageValue(cid, t.storage) == -1 then
        doPlayerAddExperience(cid, t.experience)
        doSendAnimatedText(p, tostring(t.experience), TEXTCOLOR_WHITE)
    end
    doPlayerAddItemEx(cid, bp)
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, t.msg)
    doSendMagicEffect(p, t.effect)
    setPlayerStorageValue(cid, t.storage, mathtime(t.time_to_get_again) + os.time())
    return true
end

function mathtime(table) -- by dwarfer
local unit = {"sec", "min", "hour", "day"}
for i, v in pairs(unit) do
if v == table[2] then
return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1)
end
end
return error("Bad declaration in mathtime function.")
end
  • Respostas 10
  • Visualizações 1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @Navegante   Em actions/scripts crie um arquivo.lua e cole isto dentro:     No actions.xml, coloque a tag como o exemplo abaixo, inserindo um actionid no lugar do XXXX e o m

Posted Images

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo