Ir para conteúdo
  • Cadastre-se

(Resolvido)Bau inteligente


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

base: 1.2

Bom dia pessoal do tibia king! Gente teriam como me ajudar com um "bau inteligente"?

Tipo ele vai funcionar da seguinte maneira:

preciso de um bau que irá da itens de acordo com a  vocação, ele vai da uma backpack para o player contendo itens dentro dela (não sei quantos itens irão ser então se possível deixa de uma forma que eu possa adicionar quantos eu precisar), alem dos itens ele vai da um bônus de experiencia o bônus pode ser a mesma configuração para todas as vocações, somente os itens deverão ser separados por vocações, se possível colocar um efeito quando o player clicar junto com uma mensagem(o efeito e a mensagem pode ser o mesmo para todas as vocações), apos o processo ser realizado caso o player venha clicar novamente no bau aparecerá uma nova mensagem dizendo que ele só irá poder pegar os itens novamente depois de 24 horas, logo ele não poderá pegar o bônus de experiencia, somente os itens.


OBS: Espero que tenha ficado bem explicado, mas qualquer duvido e só postar que eu tentarei tirá-la o mais rápido possível, eu mesmo tentei reproduzir esse script, mas não obtive muito sucesso. :(

 

 

 



Aliás agradeço desde já a boa alma que for me ajudar e claro! Nunca esquecerei do REP+ ?

Link para o post
Compartilhar em outros sites
  • Solução

@Navegante

 

Em actions/scripts crie um arquivo.lua e cole isto dentro:

 

Spoiler

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(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(t.storage) > os.time() then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can take the reward again at "..os.date("%d %B %Y %X", player:getStorageValue(t.storage))..".")
        return true
    end
    local tab = {}
    for voc_tab, items in pairs(t.voc_items) do
        if isInArray(voc_tab, player:getVocation():getId()) then
            tab = items
            break
        end
    end
    if #tab == 0 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your vocation is not allowed to get the reward.")
        return true
    end
    local bp = Container(doCreateItemEx(t.backpack_id, 1))
    for i = 1, #tab do
        local id, count = tab[i][1], tab[i][2]
        if ItemType(id):isStackable() then
            bp:addItem(id, count)
        else
            for k = 1, count do
                bp:addItem(id, 1)
            end
        end
    end
    local bpWeight = bp:getWeight()
    if player:getFreeCapacity() < bpWeight then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(t.backpack_id):getName() .. ' weighing ' .. bpWeight .. ' oz it\'s too heavy.')
        return true
    end
    if player:getStorageValue(t.storage) == -1 then
        player:addExperience(t.experience, true)
    end
    player:addItemEx(bp)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, t.msg)
    player:getPosition():sendMagicEffect(t.effect)
    player:setStorageValue(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

 

 

No actions.xml, coloque a tag como o exemplo abaixo, inserindo um actionid no lugar do XXXX e o mesmo valor para o actionid do baú.

<action actionid="XXXX" script="NOMEDOSEUARQUIVO.lua"/>

 

Contato:

 

Link para o post
Compartilhar em outros sites
2 horas atrás, Dwarfer disse:

@Navegante

 

Em actions/scripts crie um arquivo.lua e cole isto dentro:

 

  Ocultar conteúdo


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(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(t.storage) > os.time() then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can take the reward again at "..os.date("%d %B %Y %X", player:getStorageValue(t.storage))..".")
        return true
    end
    local tab = {}
    for voc_tab, items in pairs(t.voc_items) do
        if isInArray(voc_tab, player:getVocation():getId()) then
            tab = items
            break
        end
    end
    if #tab == 0 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your vocation is not allowed to get the reward.")
        return true
    end
    local bp = Container(doCreateItemEx(t.backpack_id, 1))
    for i = 1, #tab do
        local id, count = tab[i][1], tab[i][2]
        if ItemType(id):isStackable() then
            bp:addItem(id, count)
        else
            for k = 1, count do
                bp:addItem(id, 1)
            end
        end
    end
    local bpWeight = bp:getWeight()
    if player:getFreeCapacity() < bpWeight then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(t.backpack_id):getName() .. ' weighing ' .. bpWeight .. ' oz it\'s too heavy.')
        return true
    end
    if player:getStorageValue(t.storage) == -1 then
        player:addExperience(t.experience, true)
    end
    player:addItemEx(bp)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, t.msg)
    player:getPosition():sendMagicEffect(t.effect)
    player:setStorageValue(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

 

 

No actions.xml, coloque a tag como o exemplo abaixo, inserindo um actionid no lugar do XXXX e o mesmo valor para o actionid do baú.


<action actionid="XXXX" script="NOMEDOSEUARQUIVO.lua"/>

 

 

tem como modificar pra tfs 0.4? se tiver agradeço parabéns pelo o script <3 

Citar

[23:46:52.555] [Error - Action Interface]
[23:46:52.555] data/actions/scripts/BauHoras.lua:onUse
[23:46:52.571] Description:
[23:46:52.571] data/actions/scripts/BauHoras.lua:16: attempt to index local 'player' (a number value)
[23:46:52.571] stack traceback:
[23:46:52.571]  data/actions/scripts/BauHoras.lua:16: in function <data/actions/scripts/BauHoras.lua:15>

 

Link para o post
Compartilhar em outros sites
4 horas atrás, Dwarfer disse:

@Navegante

 

Em actions/scripts crie um arquivo.lua e cole isto dentro:

 

  Mostrar conteúdo oculto


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(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(t.storage) > os.time() then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can take the reward again at "..os.date("%d %B %Y %X", player:getStorageValue(t.storage))..".")
        return true
    end
    local tab = {}
    for voc_tab, items in pairs(t.voc_items) do
        if isInArray(voc_tab, player:getVocation():getId()) then
            tab = items
            break
        end
    end
    if #tab == 0 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your vocation is not allowed to get the reward.")
        return true
    end
    local bp = Container(doCreateItemEx(t.backpack_id, 1))
    for i = 1, #tab do
        local id, count = tab[i][1], tab[i][2]
        if ItemType(id):isStackable() then
            bp:addItem(id, count)
        else
            for k = 1, count do
                bp:addItem(id, 1)
            end
        end
    end
    local bpWeight = bp:getWeight()
    if player:getFreeCapacity() < bpWeight then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(t.backpack_id):getName() .. ' weighing ' .. bpWeight .. ' oz it\'s too heavy.')
        return true
    end
    if player:getStorageValue(t.storage) == -1 then
        player:addExperience(t.experience, true)
    end
    player:addItemEx(bp)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, t.msg)
    player:getPosition():sendMagicEffect(t.effect)
    player:setStorageValue(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

 

 

No actions.xml, coloque a tag como o exemplo abaixo, inserindo um actionid no lugar do XXXX e o mesmo valor para o actionid do baú.


<action actionid="XXXX" script="NOMEDOSEUARQUIVO.lua"/>

 

Amigo, eu ainda não tiver oportunidade de testar o script, mas amanha a tarde eu irei testa-lo com toda certeza! Já vou deixando o meu obrigado e REP+ pela ajuda no tópico. :)

Muito obrigado!!!!

Link para o post
Compartilhar em outros sites
19 horas atrás, ADM Mayk on BaiakME disse:

tem como modificar pra tfs 0.4? se tiver agradeço parabéns pelo o script <3 

 

Spoiler

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

 

 

Contato:

 

Link para o post
Compartilhar em outros sites

 

Em 22/08/2018 em 21:18, Dwarfer disse:

@Navegante

 

Em actions/scripts crie um arquivo.lua e cole isto dentro:

 

  Ocultar conteúdo


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(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(t.storage) > os.time() then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can take the reward again at "..os.date("%d %B %Y %X", player:getStorageValue(t.storage))..".")
        return true
    end
    local tab = {}
    for voc_tab, items in pairs(t.voc_items) do
        if isInArray(voc_tab, player:getVocation():getId()) then
            tab = items
            break
        end
    end
    if #tab == 0 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your vocation is not allowed to get the reward.")
        return true
    end
    local bp = Container(doCreateItemEx(t.backpack_id, 1))
    for i = 1, #tab do
        local id, count = tab[i][1], tab[i][2]
        if ItemType(id):isStackable() then
            bp:addItem(id, count)
        else
            for k = 1, count do
                bp:addItem(id, 1)
            end
        end
    end
    local bpWeight = bp:getWeight()
    if player:getFreeCapacity() < bpWeight then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(t.backpack_id):getName() .. ' weighing ' .. bpWeight .. ' oz it\'s too heavy.')
        return true
    end
    if player:getStorageValue(t.storage) == -1 then
        player:addExperience(t.experience, true)
    end
    player:addItemEx(bp)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, t.msg)
    player:getPosition():sendMagicEffect(t.effect)
    player:setStorageValue(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

 

 

No actions.xml, coloque a tag como o exemplo abaixo, inserindo um actionid no lugar do XXXX e o mesmo valor para o actionid do baú.


<action actionid="XXXX" script="NOMEDOSEUARQUIVO.lua"/>

 

@Dwarfer

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

 

Editado por ADM Mayk on BaiakME
não funcionou totalmente (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 9 months later...
Em 23/08/2018 em 19:11, Dwarfer disse:

 

  Mostrar conteúdo oculto


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

 

 

 

lamento por reviver o tópico mais poderia me ajudar dwarfer ? estou precisando muito 

Link para o post
Compartilhar em outros sites
5 horas atrás, ADM Mayk on BaiakME disse:

lamento por reviver o tópico mais poderia me ajudar dwarfer ? estou precisando muito 

 

diga, talvez eu possa

O rei de seu proprio destino é aquele que luta pela gloria do amanhã!
Discord : ZoR#9373


 

Link para o post
Compartilhar em outros sites
Em 21/06/2019 em 01:32, ZikaLord disse:

diga, talvez eu possa

 

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

Link para o post
Compartilhar em outros sites
5 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

 

qual script você tá usando?

O rei de seu proprio destino é aquele que luta pela gloria do amanhã!
Discord : ZoR#9373


 

Link para o post
Compartilhar em outros sites
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
Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo