Postado Maio 6, 2017 8 anos @poko360 Eu não tinha entendido no inicio. Enfim tenta assim: Spoiler local config = { timeExhausted = 24, -- tempo em horas para poder usar o item novamente. timeForUse = 6, -- tempo em horas que o player poderá entrar na cave. exhausted = 456789, storage = 789456, toKnow = 123456, effect = 27, -- efeito que dará ao usar o item. forbiddenAreas = { {from = {x = 1000, y = 1000, z = 6}, to = {x = 1500, y = 1500, z = 7}} -- configurar area de ponta a ponta } } function onUse(cid, item, frompos, item2, topos) for _, players in pairs(getPlayersOnline()) do for _, areas in pairs(config.forbiddenAreas) do if(isInRange(getThingPos(players), areas.from, areas.to)) then doPlayerSendCancel(cid, "Já tem alguem nesta area.") return false end end end if(getPlayerStorageValue(cid, config.exhausted) < os.time() and item.itemid == 4864 and getPlayerLevel(cid) > 50000) then setPlayerStorageValue(cid, config.storage, config.timeForUse * 60 * 60 + os.time()) setPlayerStorageValue(cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time()) setPlayerStorageValue(cid, config.toKnow, 1) doRemoveItem(item.uid,1) doSendMagicEffect(getThingPos(cid), config.effect) doPlayerSendTextMessage(cid, 19, "Agora você tem acesso a PayHunt por 6 horas.") return true elseif(getPlayerStorageValue(cid, config.exhausted) > os.time()) then doPlayerSendTextMessage(cid, 19, "*Você esta exausto, aguarde 24 horas desde a ultima vez que voce usou o item.") elseif(item.itemid > 4864) then doPlayerSendTextMessage(cid, 19, "*O item deve ficar dentro a backpack para usa-lo") elseif(getPlayerLevel(cid) < 50000) then doPlayerSendTextMessage(cid, 19, "*Você precisa ser level 50.000+") end return false end Editado Maio 7, 2017 8 anos por MaTTch (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.