Ir para conteúdo

Featured Replies

Postado

e bota um setPlayerStorageValue

É mais simples usar um global storage na própria action da quest.

[...]

local gb = {1234, 24} -- {global storage key, duration in hours}
if getGlobalStorageValue(gb[1]) - os.time() < 1 then
. . .
setGlobalStorageValue(gb[1], os.time() + (gb[2] * 3600))

[...]

 

@falling

Se não souber como aplicar, poste o script da quest.

  • Respostas 22
  • Visualizações 1.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Alguem pode me ajudar? http://www.tibiaking.com/forum/topic/47762-erro-no-fishing-system/

  • function onUse(cid)     local t = {item = {5432, 1}, stor = {50040, 50041}} -- {item = {itemID, amount}, stor = {storage, globalstorage}}     if getGlobalStorageValue(t.stor[2]) - os.time() < 1 the

  • Desculpe. Eu esqueci que você queria que "zerasse" o tempo exatamente à meia noite. Nesse caso: function onUse(cid) local t = {item = {5432, 1}, stor = {50040, 50041}} -- {item = {itemID, amount},

Postado
  • Autor

@Suicide

function onUse(cid, item, frompos, item2, topos)

	if item.uid == 50040 then
		if getPlayerStorageValue(cid,50040) == -1 then
			doPlayerSendTextMessage(cid,25,"You have found a Stamina Reifl.")
			doPlayerAddItem(cid,XXX,1)
			setPlayerStorageValue(cid,50040,1)
		else
			doPlayerSendTextMessage(cid,25,"The is empty.")
		end

	end
	return TRUE
end
Postado
function onUse(cid)
    local t = {item = {5432, 1}, stor = {50040, 50041}} -- {item = {itemID, amount}, stor = {storage, globalstorage}}
    if getGlobalStorageValue(t.stor[2]) - os.time() < 1 then
        if getPlayerStorageValue(cid, t.stor[1]) < 1 then
            setPlayerStorageValue(cid, t.stor[1], 1)
            setGlobalStorageValue(t.stor[2], os.time() + (24 * 3600))
            doPlayerAddItem(cid, t.item[1], t.item[2])
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You received '..t.item[2]..' '..t.item[1])
        else
            return doPlayerSendCancel(cid, 'You already have completed this quest.')
        end
    else
        return doPlayerSendCancel(cid, 'Someone already has done this quest today, try tomorrow.')
    end
    
    return true
end

No caso, começará a valer o tempo de 24 horas, a partir do momento em que o player der use no item que contém o actionID/uniqueID estipulado na tag desse script.

Editado por Suicide (veja o histórico de edições)

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.6k

Informação Importante

Confirmação de Termo