Ir para conteúdo
  • Cadastre-se

Posts Recomendados

1zfsr28.jpg

 

 

yalaharcrate.lua

local items = {7620, 7618, 2148, 2148, 9808, 9811, 2671, 2666, 2789, 2213, 2145, 2145, 5710}
local count = {1, 1, 50, 80, 1, 1, 5, 8, 5, 1, 1, 2, 1}

local countable = {2148, 2789, 2145}
local uncountable = {2666, 2671}

function onUse(cid, item, fromPosition, itemEx, toPosition)

local compareTime = 3600
local currentValue = getPlayerStorageValue(cid, 65000)

if currentValue == -1 then
	setPlayerStorageValue(cid, 65000, os.time())
end

    if (os.time() - currentValue) >= compareTime then
        setPlayerStorageValue(cid, 65000, os.time())
        local myItem = math.random(1, #items)
        doPlayerAddItem(cid, items[myItem], count[myItem])
		if isInArray(countable, item[myItem]) and count[myItem] > 1 then
			doCreatureSay(cid, "You have found " .. count[myItem]  .. " " .. getItemName(items[myItem]) .. "s.", TALKTYPE_ORANGE_1)
		elseif count[myItem] == 1 then
			doCreatureSay(cid, "You have found a " .. getItemName(items[myItem]) .. ".", TALKTYPE_ORANGE_1)
		end
	else
		doCreatureSay(cid, "You found nothing useful.", TALKTYPE_ORANGE_1)
    end
    return TRUE
end
Link para o post
Compartilhar em outros sites

Tenta esse:

local items = {7620, 7618, 2148, 2148, 9808, 9811, 2671, 2666, 2789, 2213, 2145, 2145, 5710}
local count = {1, 1, 50, 80, 1, 1, 5, 8, 5, 1, 1, 2, 1}

local countable = {2148, 2789, 2145}
local uncountable = {2666, 2671}

function onUse(cid, item, fromPosition, itemEx, toPosition)

local compareTime = 3600
local currentValue = getPlayerStorageValue(cid, 65000)

if currentValue == -1 then
	setPlayerStorageValue(cid, 65000, os.time())
end

    if (os.time() - currentValue) >= compareTime then
        setPlayerStorageValue(cid, 65000, os.time())
        local myItem = math.random(1, #items)
        doPlayerAddItem(cid, items[myItem], count[myItem])
		if isInArray(countable, item[myItem]) and count[myItem] > 1 then
			doCreatureSay(cid, "You have found " .. count[myItem]  .. " " .. getItemNameById(items[myItem]) .. "s.", TALKTYPE_ORANGE_1)
		elseif count[myItem] == 1 then
			doCreatureSay(cid, "You have found a " .. getItemNameById(items[myItem]) .. ".", TALKTYPE_ORANGE_1)
		end
	else
		doCreatureSay(cid, "You found nothing useful.", TALKTYPE_ORANGE_1)
    end
    return true
end
Editado por danihcv (veja o histórico de edições)

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo