Ir para conteúdo

Featured Replies

Postado

 
local storage = 25000
local level_reward = {
     [100] = {items = {{itemid = 2191, count = 1}, {itemid = 7618, count = 20}}},
     [150] = {items = {{itemid = 8921, count = 1}, {itemid = 7620, count = 50}}},
     [250] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
     [300] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
     [350] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},	 
     [400] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},	
     [450] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
     [500] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}}	  
 } 

 
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)

if player:getStorageValue(storage) == tonumber(os.date("%w")) then
return player:sendCancelMessage("The chest is empty, come back tomorrow for a new reward.")
end



for lvl, x in pairs(level_reward) do

             for lvl, z in pairs(x) do

                     local text = ""
					 local z = z[player:getLevel()]
                     for v = 1, #z.items do
                         count, info = z.items[v].count, getItemDescriptions(z.items[v].itemid)
                         local ret = ", "
                         if v == 1 then
                             ret = ""
                         elseif v == #z.items then
                             ret = " and "
                         end
                         text = text .. ret
                         text = text .. (count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name)
						 player:addItem(z.items[v].itemid, z.items[v].count)
                     end
					 
                     player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations, you reached level "..level.." and received "..text..".")
                     player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
                     player:setStorageValue(storage, tonumber(os.date("%w")))					 
					 
                 end
             end
         end

nao logro fazer função

 

meu script cambia reward on level

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

  • 1 year later...
Postado

cria um baú que só pode pegar 1x em cada 24hrs

 

 

 local t = {


storage = 678678,  -- storage, so mude se tiver usando pra outra coisa.
tempo = 24, -- Tempo em horas.
qt = 1, -- quatidade.
itemidxx = 1990 -- Item que ira ganhar.
}
function onUse(cid, item, fromPos, itemEx, toPos)
    if getPlayerStorageValue(cid, t.storage) - os.time() > 0 then
        return doPlayerSendTextMessage(cid, 25, "Vocę só poderá abrir seu bau em "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,t.storage))..".")
    end
       setPlayerStorageValue(cid, t.storage, os.time() + t.tempo * 60 * 60)
       doPlayerSendTextMessage(cid, 25, "Voce ganhou seu presente diário, espere até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,t.storage)).." para pegar novamente.")
       doPlayerAddItem(cid,t.itemidxx,t.qt)
    return true
end
 

 

actions.xml

Citar

 


<action actionid="22164" script="Bau_Diario.lua"/>

 

não esquece de colocar o action ID no baú, depois coloca um script pra o item 1990 presente, dar outros itens aleatorios

Editado por JuremaFox (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