Ir para conteúdo

Ruyzin Pikatxufly

Membro
  • Registro em

  • Última visita

  1. Ruyzin Pikatxufly alterou sua foto pessoal
  2. é isso que precisa? local config = { hourly = "no", -- permitir apenas uma entrada por hora? level = 100, storage = 30015, entry = { {x = 247, y = 659, z = 13}, {x = 247, y = 660, z = 13}, {x = 247, y = 661, z = 13}, {x = 247, y = 662, z = 13} }, destination = { {x = 189, y = 650, z = 13}, {x = 189, y = 651, z = 13}, {x = 189, y = 652, z = 13}, {x = 189, y = 653, z = 13} } } config.hourly = getBooleanFromString(config.hourly) function onUse(cid, item, fromPosition, itemEx, toPosition) if (item.itemid == 1946) then if (config.hourly) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) else doTransformItem(item.uid, item.itemid - 1) end return true end if (item.itemid ~= 1945) then return true end local players = {} for _, position in ipairs(config.entry) do local pid = getTopCreature(position).uid if (pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) return true end table.insert(players, pid) end for i, pid in ipairs(players) do doSendMagicEffect(config.entry[i], CONST_ME_POFF) doTeleportThing(pid, config.destination[i], false) doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA) end doTransformItem(item.uid, item.itemid + 1) return true end
  3. Desculpe amigo então não estou entendendo.
  4. local config = { message = "Teleport se fechará em 90 segundos. Corra antes que feche.", timeToRemove = 90, -- segundos teleportId = 1387, bosses = { ["Boss Thdagger"] = { x = 263, y = 349, z = 7 }, } } local function removal(position) local teleport = getTileItemById(position, config.teleportId) if teleport then doRemoveItem(teleport.uid) end end function onDeath(cid, corpse, killer) unregisterCreatureEvent(cid, "Boss Thdagger") local position = getCreaturePosition(cid) for name, pos in pairs(config.bosses) do if name == getCreatureName(cid) then local teleportPosition = { x = pos.x + 10, y = pos.y + 10, z = pos.z } -- Posição do teleport (+10 nas coordenadas x e y) local teleport = doCreateTeleport(config.teleportId, teleportPosition, pos) doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1) addEvent(removal, config.timeToRemove * 1000, teleportPosition) doSendMagicEffect(position, 10) break end end return true end Entendi errado então ve se é isso que você precisa. Mude o teleport position.
  5. Tenta esse: local config = { message = "Teleport se fechará em 45 minutos. Corra antes que feche.", timeToRemove = 45 * 60, -- segundos teleportId = 1387, bosses = { ["Boss Thdagger"] = { x = 263, y = 349, z = 7 }, } } local function removal(position) local teleport = getTileItemById(position, config.teleportId) if teleport.itemid == config.teleportId then doRemoveItem(teleport.uid) end end function onDeath(cid, corpse, killer) unregisterCreatureEvent(cid, "Boss Thdagger") local position = getCreaturePosition(cid) for name, pos in pairs(config.bosses) do if name == getCreatureName(cid) then local teleport = doCreateTeleport(config.teleportId, pos, position) doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1) addEvent(removal, config.timeToRemove * 1000, position) doSendMagicEffect(position, 10) break end end return true end
  6. <action itemid="8981" script="access.lua"/> local storageValue = 13741 local itemID = 8981 -- Item utilizado para conceder o acesso de 72 horas local teleportPosition = {x = 154, y = 51, z = 7} -- Posição de teleporte quando o tempo acabar local timeInterval = 1 * 60 -- Intervalo de tempo em segundos (30 minutos) function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, storageValue) ~= -1 then doPlayerSendCancel(cid, "Você já tem acesso a essa funcionalidade.") return true end if not doPlayerRemoveItem(cid, itemID, 1) then doPlayerSendCancel(cid, "Você precisa ter o item necessário para usar essa funcionalidade.") return true end local currentTime = os.time() local accessTime = 72 * 60 * 60 -- Convertendo 72 horas para segundos local expirationTime = currentTime + accessTime setPlayerStorageValue(cid, storageValue, expirationTime) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você ganhou acesso a essa funcionalidade por 72 horas.") return true end function onLogin(cid) local currentTime = os.time() local expirationTime = getPlayerStorageValue(cid, storageValue) if expirationTime ~= -1 and currentTime >= expirationTime then doTeleportThing(cid, teleportPosition, false) setPlayerStorageValue(cid, storageValue, -1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu acesso expirou. Você foi teleportado para a posição 154, 51, 7.") end local timeDifference = currentTime - getPlayerStorageValue(cid, "lastTimeCheck") if timeDifference >= timeInterval then local timeRemaining = expirationTime - currentTime local hours = math.floor(timeRemaining / 3600) local minutes = math.floor((timeRemaining % 3600) / 60) local seconds = timeRemaining % 60 local timeString = string.format("%02d:%02d:%02d", hours, minutes, seconds) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Tempo restante: " .. timeString) setPlayerStorageValue(cid, "lastTimeCheck", currentTime) end return true end <movevent type="StepIn" uniqueid="18956" event="script" value="acessoTile.lua"/> function onStepIn(cid, item, position, fromPosition) local sto = 13741 -- storage Aqui if isPlayer(cid) then if getPlayerStorageValue(cid, sto) >= 1 then doPlayerSendTextMessage(cid, 25, "Seja bem vindo a area.") else doTeleportThing(cid, fromPosition, true) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) doPlayerSendTextMessage(cid, 25, "Você Não Tem Acesso!") end end return true end
  7. local accessItemId = 1234 -- ID do item necessário para acessar a área local accessAreaId = 5678 -- ID da área que será concedido acesso local accessDuration = 72 -- Duração do acesso em horas function onUse(cid, item, fromPosition, itemEx, toPosition) -- Verificar se o jogador já tem acesso à área if getPlayerStorageValue(cid, accessAreaId) > os.time() then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já tem acesso a esta área.") return true end -- Verificar se o jogador possui o item necessário if not doPlayerRemoveItem(cid, accessItemId, 1) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa do item necessário para acessar esta área.") return true end -- Calcular o tempo de expiração do acesso local expirationTime = os.time() + (accessDuration * 3600) -- Armazenar o tempo de expiração no jogador setPlayerStorageValue(cid, accessAreaId, expirationTime) -- Remover o item do inventário do jogador doRemoveItem(item.uid) -- Notificar o jogador sobre o acesso concedido doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você recebeu acesso à área por 72 horas.") return true end <action name="accessArea" event="script" value="access.lua"/> Tenta Em Actions. Desculpa não estar testando, é que to muito ocupado.
  8. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local itemId = 2160 function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function onCreatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) -- Obter o objeto Player if msgcontains(msg, "serial") then npcHandler:say("Eu coloco um identificador em seu item. Cobro pelo serviço um valor de 1 crystal coin. Deseja colocar em algum item?", cid) talkState[cid] = 0 elseif talkState[cid] == 0 and msgcontains(msg, 'yes') then npcHandler:say("Qual item você está interessado em colocar o serial? Lembrando que isso não garante que o item pertence a você para sempre, se você perder o item a responsabilidade será sua e não da Equipe.", cid) talkState[cid] = 1 elseif talkState[cid] == 1 then local item = player:getItemById(itemId, true) -- Procurar pelo item no inventário do jogador if item and item:isItem() then if player:removeItem(2160, 1) then -- Remover 1 Crystal Coin do jogador local description = "Este item foi registrado pelo jogador " .. player:getName() .. " no dia " .. os.date("%d/%m/%Y - %X") .. " Serial: " .. player:getGuid() .. "." local itemText = item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION) if itemText and itemText ~= "" then itemText = itemText .. "\n" .. description else itemText = description end item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, itemText) npcHandler:say("Aqui está o seu item. Deseja registrar outro?", cid) else npcHandler:say("Você não tem a quantidade necessária para registrar esse item.", cid) end else npcHandler:say("Você não possui este item.", cid) end talkState[cid] = 0 else npcHandler:say("Pena que você não quer. Volte aqui quando estiver interessado.", cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback) npcHandler:addModule(FocusModule:new()) e Assim?
  9. Doidodepeda reagiu a uma resposta no tópico: Cooldown em items (USE) actions
  10. local accessItemId = 1234 -- ID do item necessário para acessar a área local accessAreaId = 5678 -- ID da área que será concedido acesso local accessDuration = 72 -- Duração do acesso em horas function onUse(cid, item, fromPosition, itemEx, toPosition) -- Verificar se o jogador já tem acesso à área if getPlayerStorageValue(cid, accessAreaId) > os.time() then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já tem acesso a esta área.") return true end -- Verificar se o jogador possui o item necessário if not doPlayerRemoveItem(cid, accessItemId, 1) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa do item necessário para acessar esta área.") return true end -- Calcular o tempo de expiração do acesso local expirationTime = os.time() + (accessDuration * 3600) -- Armazenar o tempo de expiração no jogador setPlayerStorageValue(cid, accessAreaId, expirationTime) -- Notificar o jogador sobre o acesso concedido doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você recebeu acesso à área por 72 horas.") return true end Vê Se Isso Te Ajuda!!
  11. local extra_loot = { {hasName = "dragon", items = { {id = 2152, count = 2, chance = 40000}, -- 40% {id = 2160, countMax = 4, chance = 99000} }}, {items = { {id = 2365, chance = 10000}, {id = 2392, chance = 1000} }}, } function Player:addExtraLoot() local monsterName = self:getKilledCreatureName():lower() for i = 1, #extra_loot do local lootConfig = extra_loot[i] if lootConfig.hasName then local targetName = lootConfig.hasName:lower() if not monsterName:match(targetName) then return true end end for j = 1, #lootConfig.items do local itemConfig = lootConfig.items[j] local count = 1 if itemConfig.count then if itemConfig.countMax then count = math.random(itemConfig.count, itemConfig.countMax) else count = itemConfig.count end else if itemConfig.countMax then count = math.random(1, itemConfig.countMax) end end if math.random(0, 100000) <= itemConfig.chance then self:addItem(itemConfig.id, count) end end end end function onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) if not creature:isMonster() or not killer:isPlayer() then return true end killer:addExtraLoot() return true end Tenta Isso aqui!!!
  12. local cooldown = 60 -- Cooldown em segundos function onUse(cid, item, frompos, item2, topos) local lastUseTime = getPlayerStorageValue(cid, 12345) local currentTime = os.time() if lastUseTime == -1 or currentTime - lastUseTime >= cooldown then doPlayerSetStamina(cid, 2520) doCreatureSay(cid, 'Stamina Full', TALKTYPE_ORANGE_1) doSendMagicEffect(frompos, 1) doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, 12345, currentTime) addEvent(function() setPlayerStorageValue(cid, 12345, -1) end, cooldown * 1000) else local remainingTime = cooldown - (currentTime - lastUseTime) local minutes = math.floor(remainingTime / 60) local seconds = remainingTime % 60 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must wait " .. minutes .. " minutes and " .. seconds .. " seconds before using this again.") end return true end Tenta Essa Ai!!

Informação Importante

Confirmação de Termo