Ir para conteúdo

Featured Replies

Resolvido por MaXwEllDeN

Ir para solução
Postado
  • Solução
local config = {
	storage = 27364,
	exhauststorage = 20932,	days = {

	["Monday"] = {itemid = 2476, count = 1, storagevalue = 1},
		["Tuesday"] = {itemid = 2488, count = 1, storagevalue = 2},
		["Wednesday"] = {itemid = 2195, count = 1, storagevalue = 3},
		["Thursday"] = {itemid = 2497, count = 1, storagevalue = 4},
		["Friday"] = {itemid = 2270, count = 1, storagevalue = 5},
		["Saturday"] = {itemid = 2141, count = 1, storagevalue = 6},
		["Sunday"] = {itemid = 2656, count = 1, storagevalue = 7}
	},
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
	local x = config.days[os.date("%A",os.time())]

	if(getPlayerStorageValue(cid, config.storage) == x.storagevalue and os.time() - getPlayerStorageValue(cid, config.exhauststorage) < 86400) then
		return doPlayerSendCancel(cid, "The chest is empty, come back tomorrow for a new reward.")
	end
	
	local info = getItemInfo(x.itemid)
	
	if(x.count > 1) then
		text = x.count .. " " .. info.plural
	else
		text = info.article .. " " .. info.name
	end
	
	local item = doCreateItemEx(x.itemid, x.count)
	
	if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
	    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	    text = "You have found a reward weighing " .. getItemWeight(item) .. " oz. It is too heavy or you have not enough space."
	else
	    text = "You have received " .. text .. "."
	    setPlayerStorageValue(cid, config.storage, x.storagevalue)
	    setPlayerStorageValue(cid, config.exhauststorage, os.time())
	end

	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
	
	return true
end

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Postado
  • Autor

Exatamente MaXwEllDeN porém eu estava testando com conta GM por isso estava pegando quantas vezes quiser, testei com uma conta de jogador e esta funcionando corretamente mesmo assim Obrigado pela atenção.

Editado por Tiodarsa. (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