Ir para conteúdo

El Rusher

Cavaleiro
  • Total de itens

    156
  • Registro em

  • Última visita

  • Dias Ganhos

    19

Tudo que El Rusher postou

  1. El Rusher

    Healing Machine

    local itemID = 1234 -- ID do item no mapa que irá acionar a cura function onUse(cid, item, fromPosition, itemEx, toPosition) if itemEx.itemid == itemID then doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) -- Cura o jogador doCureStatus(cid, "all", true) -- Cura todos os status negativos do jogador doSendMagicEffect(getThingPos(cid), EFFECT_HEAL) -- Efeito de cura local backpack = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK) if backpack.itemid == 0 then return true end local iter = makeItemIter(backpack.uid) local ball = iter.next() while ball.itemid ~= 0 do if isPokeball(ball.itemid) then local creatureID = getItemAttribute(ball.uid, "pokeid") if creatureID then doCreatureAddHealth(creatureID, getCreatureMaxHealth(creatureID) - getCreatureHealth(creatureID)) -- Cura o Pokémon doCureStatus(creatureID, "all", true) -- Cura todos os status negativos do Pokémon doSendMagicEffect(getThingPos(creatureID), EFFECT_HEAL) -- Efeito de cura end end ball = iter.next() end iter.free() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Todos os seus Pokémon foram curados.") -- Mensagem de sucesso end return true end function isPokeball(itemid) -- Adicione aqui os itemids das pokébolas que deseja considerar local validPokeballIDs = {1, 2, 3, 4} -- Por exemplo, considere as pokébolas com IDs 1, 2, 3, 4 for _, id in ipairs(validPokeballIDs) do if itemid == id then return true end end return false end
  2. local monsterRanks = { ['ASTRA'] = {score = 0}, -- Inicialmente, o score é zero } function onUse(cid, item, fromPosition, itemEx, toPosition) local monsterName = "ASTRA" if monsterRanks[monsterName] ~= nil then local str = "Rank de Monstros:\n\n" str = str .. monsterName .. ": " .. monsterRanks[monsterName].score .. " derrotados" doShowTextDialog(cid, 6500, str) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Monstro não encontrado no ranking.") end return true end
  3. local config = { monsters = {"The Mega Boss Rox"}, rewards = { {itemID = 2160, chanceToGainInPercent = 3, quantity = 100}, {itemID = 2148, chanceToGainInPercent = 3, quantity = 100}, }, effect = 27, backpackID = 1988, -- ID da Backpack } -- Função para selecionar um item com base na porcentagem function selectRandomItem() local totalChance = 0 for _, reward in pairs(config.rewards) do totalChance = totalChance + reward.chanceToGainInPercent end local randomValue = math.random(1, totalChance) local cumulativeChance = 0 for _, reward in pairs(config.rewards) do cumulativeChance = cumulativeChance + reward.chanceToGainInPercent if randomValue <= cumulativeChance then return reward end end end function onKill(cid, target, lastHit) if isPlayer(cid) and isMonster(target) then if getCreatureMaster(target) ~= nil then return true end local monsterNameKilled = getCreatureName(target) if isInArray(config.monsters, monsterNameKilled) then local selectedItem = selectRandomItem() local backpack = doPlayerAddItem(cid, config.backpackID, 1) if backpack ~= RETURNVALUE_NOERROR then local item = doCreateItemEx(selectedItem.itemID, selectedItem.quantity) doAddContainerItem(backpack, item) doSendMagicEffect(getCreaturePosition(cid), config.effect) doBroadcastMessage("Mataram o boss.", 19) else doPlayerAddItem(cid, selectedItem.itemID, selectedItem.quantity) doSendMagicEffect(getCreaturePosition(cid), config.effect) doBroadcastMessage("Mataram o boss.", 19) end end end return true end function onLogin(cid) registerCreatureEvent(cid, "killTheBoss") return true end
  4. local config = { itemsToTrade = { -- Lista de itens a serem trocados {itemId = 1234, count = 3}, -- Exemplo: {itemId = ID_DO_ITEM, count = QUANTIDADE} {itemId = 5678, count = 2}, -- Adicione mais itens conforme necessário }, newItemId = 9876, -- ID do novo item a ser dado ao jogador leverId = 12345, -- ID da alavanca } function onUse(cid, item, fromPosition, itemEx, toPosition) if itemEx.itemid == config.leverId then local playerItems = {} -- Tabela para armazenar os itens do jogador -- Verifica se o jogador possui todos os itens necessários for _, tradeItem in ipairs(config.itemsToTrade) do local playerItemCount = getPlayerItemCount(cid, tradeItem.itemId) if playerItemCount < tradeItem.count then doPlayerSendCancel(cid, "Você não tem todos os itens necessários para a troca.") return true else playerItems[#playerItems + 1] = {itemId = tradeItem.itemId, count = tradeItem.count} end end -- Remove os itens do jogador for _, playerItem in ipairs(playerItems) do doPlayerRemoveItem(cid, playerItem.itemId, playerItem.count) end -- Dá o novo item ao jogador doPlayerAddItem(cid, config.newItemId, 1) doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você trocou os itens com sucesso!") -- Remove a alavanca após o uso doRemoveItem(item.uid) return true end return false end
  5. local config = { SKILL_ID = 0, -- id do skill... multiplier = 1.5, percentual = 0.5, } function onUse(cid, item, fromPosition, itemEx, toPosition) if isPlayer(itemEx.uid) then local chance = (getPlayerSkillLevel(itemEx.uid, config.SKILL_ID) * config.percentual) * 10 if math.random(1, 1400) <= chance then doCreatureSay(itemEx.uid, "Você ativou o efeito crítico!", TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(itemEx.uid), CONST_ME_MAGIC_RED) else doCreatureSay(itemEx.uid, "Você não ativou o efeito crítico.", TALKTYPE_ORANGE_1) end end return true end
  6. Abra o arquivo constants.lua e adicione a função getExpForLevel: -- constants.lua function getExpForLevel(level) level = level - 1 return ((50 * level * level * level) - (150 * level * level) + (400 * level)) / 3 end Abra o arquivo player.lua localizado em data/events/scripts/ e adicione o código para verificar o bloqueio de nível dentro do evento onGainExperience: -- player.lua local level_tiers = { {level = 20, storage = 50000, value = 1}, -- level, quest_storage, value_required {level = 40, storage = 50001, value = 1}, {level = 60, storage = 50002, value = 1}, } function Player:onGainExperience(source, exp, rawExp) local experience = exp for _, array in ipairs(level_tiers) do if self:getStorageValue(array.storage) < array.value then local current_exp, level_exp = self:getExperience(), getExpForLevel(array.level) if (current_exp + experience) > level_exp then experience = math.max(0, level_exp - current_exp) break end end end return experience end Isso adicionará a verificação do bloqueio de nível ao evento onGainExperience, garantindo que os jogadores não possam ganhar experiência além do limite permitido para o seu nível, a menos que cumpram os requisitos de armazenamento definidos nas level_tiers.
  7. precisa ser mais especifico meu nobre, tem 1000 razoes ou mais que ocasionam isso, por exemplo Falha de Memória ou Vazamento de Memória, Sobrecarga do Servidor, Erros de Script, Problemas de Configuração, Atualizações e Patches, Logs de Erro, etc etc
  8. function onUse(cid, item, fromPosition, itemEx, toPosition) local manaToRestore = 150 + getPlayerMagLevel(cid) * 2 if doPlayerAddMana(cid, manaToRestore) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) doRemoveItem(item.uid, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been healed for " .. manaToRestore .. " mana points.") else doPlayerSendCancel(cid, "You cannot use this item right now.") end return true end Certifique-se de substituir getItemMagLevel(cid) pela função real que você está usando para obter o nível de magia do jogador no seu servidor. Além disso, ajuste os valores conforme necessário para equilibrar o jogo de acordo com suas preferências.
  9. <?xml version="1.0" encoding="UTF-8"?> <mod name="Vipsystem" version="1.0" author="Aco" contact="http://otland.net/members/acordion" enabled="yes"> <!--- Information Vip Item = 10503 set action id 11223 to the tile you want to be vip tile set action id 2112 to the door you want to be vip door MYSQL TABLE ALTER TABLE `accounts` ADD `vipdays` int(11) NOT NULL DEFAULT 0; --> <config name="VipFuctions"><![CDATA[ --- Vip functions by Kekox function getPlayerVipDays(accountId) local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. accountId .. " LIMIT 1") if Info:getID() ~= LUA_ERROR then local days= Info:getDataInt("vipdays") Info:free() return days end return LUA_ERROR end function doAddVipDays(accountId, days) db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. accountId .. ";") end function doRemoveVipDays(accountId, days) db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. accountId .. ";") end ]]></config> <globalevent name="VipDaysRemover" time="00:01" event="script"><![CDATA[ --- Script by Kekox. function onTime() db.executeQuery("UPDATE accounts SET vipdays = vipdays - 1 WHERE vipdays > 0;") return true end ]]></globalevent> <globalevent name="vipEffect" interval="2" event="script"><![CDATA[ domodlib('VipFuctions') --- Script By Kekox. function onThink(interval, lastExecution) for _, name in ipairs(getOnlinePlayers()) do local cid = getPlayerByName(name) local accountId = getPlayerAccountId(cid) if getPlayerVipDays(accountId) >= 1 then doSendMagicEffect(getPlayerPosition(cid), 27) doSendAnimatedText(getPlayerPosition(cid), "VIP!", TEXTCOLOR_RED) end end return true end ]]></globalevent> <event type="login" name="Vip" event="script"><![CDATA[ --- Script by Kekox. function onLogin(cid) registerCreatureEvent(cid, "VipCheck") return true end ]]></event> <event type="login" name="VipCheck" event="script"><![CDATA[ domodlib('VipFuctions') --- Script by Kekox. function onLogin(cid) local accountId = getPlayerAccountId(cid) if getPlayerVipDays(accountId) >= 1 then doPlayerSendTextMessage(cid, 19, "You have ".. getPlayerVipDays(accountId) .." vip days left.") end return true end ]]></event> <movevent type="StepIn" actionid="11223" event="script"><![CDATA[ domodlib('VipFuctions') --- Script by Kekox. function onStepIn(cid, item, position, fromPosition) local accountId = getPlayerAccountId(cid) if getPlayerVipDays(accountId) == 0 then doTeleportThing(cid, fromPosition, FALSE) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only VIP Account can go there.") end return true end ]]></movevent> <action actionid="13500" event="script"><![CDATA[ domodlib('VipFuctions') --- Script by Kekox. function onUse(cid, item, frompos, item2, topos) local accountId = getPlayerAccountId(cid) if getPlayerVipDays(accountId) >= 1 then pos = getPlayerPosition(cid) if pos.x == topos.x then if pos.y < topos.y then pos.y = topos.y + 1 else pos.y = topos.y - 1 end elseif pos.y == topos.y then if pos.x < topos.x then pos.x = topos.x + 1 else pos.x = topos.x - 1 end else doPlayerSendTextMessage(cid,22,"Stand in front of the door.") return true end doTeleportThing(cid,pos) doSendMagicEffect(topos,12) else doPlayerSendTextMessage(cid,22,'Only VIP Account can go there.') end return true end ]]></action> <action itemid="11111" event="script"><![CDATA[ domodlib('VipFuctions') --- Script by Kekox. function onUse(cid, item, fromPosition, itemEx, toPosition) local accountId = getPlayerAccountId(cid) if getPlayerVipDays(accountId) > 365 then doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.") else doAddVipDays(cid, 30) doCreatureSay(cid, "Vip", TALKTYPE_ORANGE_1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "We have added 30 vip days to your account.") doRemoveItem(item.uid) end return true end ]]></action> </mod>
  10. tem que dar uma procurada nas funções do seu servidor se tem algo que faça isso, se encontrar pode usar meu script como base: function moveItemsToPersonalDepot(player) local house = player:getTile():getHouse() if not house then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não está em uma casa.") return end local personalDepot = player:getDepot() if not personalDepot then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não possui um depot pessoal.") return end local houseItems = house:getItems() for _, item in ipairs(houseItems) do if item:isMoveable() then local moved = personalDepot:addItem(item) if moved then item:remove() end end end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Todos os itens da sua casa foram transferidos para o seu depot pessoal.") end function onSay(player, words, param) if param == "!leavehouse" then moveItemsToPersonalDepot(player) end return false end
  11. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) local itemid, count = 9020, 300 -- Edite o id e a quantidade do item aqui if isInArray({"recover", "recuperar", "exp", "experience"}, msg) then npcHandler:say("Você deseja recuperar a experiência perdida após a sua morte por " .. count .. " " .. getItemNameById(itemid) .. "? {yes}", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerStorageValue(cid, death_table.before_exp) ~= -1 and getPlayerExperience(cid) < getPlayerStorageValue(cid, death_table.before_exp) then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local count = (getPlayerStorageValue(cid, death_table.before_exp) - getPlayerStorageValue(cid, death_table.after_exp)) doPlayerAddExp(cid, count) npcHandler:say("Obrigado! Aqui está sua experiência.", cid) else npcHandler:say("Desculpe, você não tem " .. getItemNameById(itemid) .. " suficientes!", cid) end else npcHandler:say("Desculpe, você não morreu ou já recuperou sua exp perdida!", cid) end talkState[talkUser] = 0 elseif msg == "no" then npcHandler:say("Then not", cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  12. function onSay(cid, words, param, channel) local maxSpellsToShow = 5000 -- Define o número máximo de feitiços a serem mostrados local t = {} -- Loop através dos feitiços do jogador for i = 0, getPlayerInstantSpellCount(cid) - 1 do if #t >= maxSpellsToShow then break -- Sai do loop se o limite máximo de feitiços for atingido end local spell = getPlayerInstantSpellInfo(cid, i) -- Verifica se o feitiço não está no nível mínimo if(spell.mlevel ~= 1) then if(spell.manapercent > 0) then spell.mana = spell.manapercent .. "%" end table.insert(t, spell) end end -- Ordena os feitiços pelo nível de magia table.sort(t, function(a, b) return a.mlevel < b.mlevel end) -- Constrói a mensagem a ser exibida local text = "" local prevLevel = -1 for i, spell in ipairs(t) do local line = "" if(prevLevel ~= spell.mlevel) then if(i ~= 1) then line = "\n" end line = line .. "Spells for Magic Level " .. spell.mlevel .. "\n" prevLevel = spell.mlevel end text = text .. line .. " " .. spell.words .. " : " .. spell.mana .. "\n" end -- Verifica o comprimento do texto if #text > 5000 then local chunks = {} local current_chunk = "" for line in text:gmatch("[^\r\n]+") do if #current_chunk + #line > 5000 then table.insert(chunks, current_chunk) current_chunk = "" end current_chunk = current_chunk .. line .. "\n" end table.insert(chunks, current_chunk) -- Mostra cada fragmento de texto ao jogador for _, chunk in ipairs(chunks) do doShowTextDialog(cid, 2175, chunk) end else -- Mostra a mensagem ao jogador doShowTextDialog(cid, 2175, text) end return true end
  13. function onStepIn(creature, item, position, fromPosition) local skillToTrain = SKILL_FISHING -- Substitua SKILL_FISHING pela habilidade que você deseja treinar local minSkill = 10 -- Substitua 10 pelo valor mínimo da habilidade para começar a treinar local gainChance = 50 -- Chance de ganhar skill, em porcentagem local requiredItemID = 1234 -- Substitua 1234 pelo ID do item necessário para treinar (por exemplo, uma vara de pescar) if creature:isPlayer() then local player = creature:getPlayer() -- Verifica se o jogador está equipado com o item necessário if player:getSlotItem(CONST_SLOT_RIGHT) and player:getSlotItem(CONST_SLOT_RIGHT):getId() == requiredItemID then local skillLevel = player:getSkillLevel(skillToTrain) if skillLevel >= minSkill then -- Verifica se o jogador ganha skill if math.random(100) <= gainChance then player:addSkillTries(skillToTrain, 1) player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Você ganhou experiência em " .. getSkillName(skillToTrain) .. ".") else player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Você não ganhou experiência em " .. getSkillName(skillToTrain) .. ".") end else player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Você não tem a habilidade necessária para treinar aqui.") end else player:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Você precisa estar equipado com o item necessário para treinar aqui.") end end return true end Certifique-se de substituir SKILL_FISHING, 10 e 1234 pelos valores apropriados para a habilidade que deseja treinar, o nível mínimo de habilidade para começar a treinar e o ID do item necessário para treinar, respectivamente. Este script irá verificar se o jogador está equipado com o item correto e se ele atende aos requisitos mínimos de habilidade antes de aumentar a habilidade de pesca do jogador com uma certa chance de sucesso. Se o jogador atender a esses critérios, ele receberá uma mensagem informando se ganhou ou não experiência na habilidade de pesca.
  14. Testa assim: local scrolls = { [1234] = {skill = SKILL__MAGLEVEL, duration = 7, multiplier = 1.5}, -- Substitua 1234 pelo ID do item do scroll de Magia [5678] = {skill = SKILL__FIST, duration = 7, multiplier = 1.5}, -- Substitua 5678 pelo ID do item do scroll de Luta de Punhos -- Adicione mais entradas conforme necessário para outros scrolls } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local scroll = scrolls[item:getId()] if scroll then if not player:addSkillTry(scroll.skill, 0) then player:sendCancelMessage("You already have this skill at maximum.") return true end if player:addSkill(scroll.skill, scroll.multiplier * player:getSkillLevel(scroll.skill)) then item:remove(1) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) player:sendTextMessage(MESSAGE_INFO_DESCR, "You have received a boost of " .. tostring(scroll.multiplier * 100) .. "% to your " .. getItemNameById(item:getId()) .. " skill for 7 days.") player:setStorageValue(1000 + scroll.skill, 1) addEvent(function(cid, skill) local player = Player(cid) if player then player:removeSkill(skill) player:sendTextMessage(MESSAGE_INFO_DESCR, "Your boost to " .. getItemNameById(item:getId()) .. " skill has worn off.") player:setStorageValue(1000 + skill, -1) end end, scroll.duration * 24 * 3600 * 1000, player:getId(), scroll.skill) else player:sendCancelMessage("You cannot use this item right now.") end end return true end E leva algumas coisas em consideraçao tambem, por exemplo: 1.Variáveis Globais: SKILL__MAGLEVEL, SKILL__FIST, SKILL__CLUB, SKILL__SWORD, SKILL__AXE, SKILL__DISTANCE, SKILL__SHIELD, MESSAGE_INFO_DESCR, CONST_ME_MAGIC_BLUE e getPlayerSkillLevel realmente existem no seu servidor? 2. O seu servidor usa a função doPlayerAddSkillTry? 3.Certifique-se de que todas as variáveis e funções utilizadas no script estejam corretamente definidas e disponíveis. 4.Verificação de item inválido: Adicione uma verificação para garantir que o itemEx não seja nil antes de acessar itemEx.itemid. Isso evitará um possível erro caso o script seja acionado com um itemEx inválido. +- nessa pegada: local scrolls = { [1234] = {skill = SKILL__MAGLEVEL, duration = 7, multiplier = 1.5}, -- Substitua 1234 pelo ID do item do scroll de Magia [5678] = {skill = SKILL__FIST, duration = 7, multiplier = 1.5}, -- Substitua 5678 pelo ID do item do scroll de Luta de Punhos -- Adicione mais entradas conforme necessário para outros scrolls } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local itemEx = target if not itemEx or not itemEx:isItem() then return false end local scroll = scrolls[itemEx:getId()] if scroll then if not player:addSkillTry(scroll.skill, 0) then player:sendCancelMessage("You already have this skill at maximum.") return true end if player:addSkill(scroll.skill, scroll.multiplier * player:getSkillLevel(scroll.skill)) then item:remove(1) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) player:sendTextMessage(MESSAGE_INFO_DESCR, "You have received a boost of " .. tostring(scroll.multiplier * 100) .. "% to your " .. getItemNameById(item:getId()) .. " skill for 7 days.") player:setStorageValue(1000 + scroll.skill, 1) addEvent(function(cid, skill) local player = Player(cid) if player then player:removeSkill(skill) player:sendTextMessage(MESSAGE_INFO_DESCR, "Your boost to " .. getItemNameById(item:getId()) .. " skill has worn off.") player:setStorageValue(1000 + skill, -1) end end, scroll.duration * 24 * 3600 * 1000, player:getId(), scroll.skill) else player:sendCancelMessage("You cannot use this item right now.") end end return true end
  15. El Rusher

    Healing Machine

    solta o script da Joy pra mim usar como base ai meu nobre
  16. Por favor, envie os códigos relacionados ao sistema de addon e à pokebar, e também qualquer informação adicional relevante que possa ajudar a entender melhor o contexto do problema. Assim, poderei fornecer uma solução mais precisa para o seu caso.
  17. local scrolls = { ["Magic Level Scroll"] = {skill = SKILL__MAGLEVEL, duration = 7, multiplier = 1.5}, ["Fist Fighting Scroll"] = {skill = SKILL__FIST, duration = 7, multiplier = 1.5}, ["Club Fighting Scroll"] = {skill = SKILL__CLUB, duration = 7, multiplier = 1.5}, ["Sword Fighting Scroll"] = {skill = SKILL__SWORD, duration = 7, multiplier = 1.5}, ["Axe Fighting Scroll"] = {skill = SKILL__AXE, duration = 7, multiplier = 1.5}, ["Distance Fighting Scroll"] = {skill = SKILL__DISTANCE, duration = 7, multiplier = 1.5}, ["Shielding Scroll"] = {skill = SKILL__SHIELD, duration = 7, multiplier = 1.5} } function onUse(cid, item, fromPosition, itemEx, toPosition) local scroll = scrolls[itemEx.itemid] if scroll then if not doPlayerAddSkillTry(cid, scroll.skill, 0) then doPlayerSendCancel(cid, "You already have this skill at maximum.") return true end if doPlayerAddSkill(cid, scroll.skill, scroll.multiplier * getPlayerSkillLevel(cid, scroll.skill)) then doRemoveItem(item.uid) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received a boost of " .. tostring(scroll.multiplier * 100) .. "% to your " .. getItemNameById(itemEx.itemid) .. " skill for 7 days.") setPlayerStorageValue(cid, 1000 + scroll.skill, 1) addEvent(function(cid, skill) if isPlayer(cid) then doPlayerRemoveSkill(cid, skill) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your boost to " .. getItemNameById(itemEx.itemid) .. " skill has worn off.") setPlayerStorageValue(cid, 1000 + skill, -1) end end, scroll.duration * 24 * 3600 * 1000, cid, scroll.skill) else doPlayerSendCancel(cid, "You cannot use this item right now.") end end return true end
  18. Parece que o problema está relacionado ao fato de que o OTX não está reconhecendo a função doPushCreature no script. Vou modificar o script para incluir a definição da função doPushCreature dentro do próprio script, o que deve ajudar a resolver o problema. Aqui está o script modificado: local spell = {} spell.config = { [3] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } }, [2] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 2, 0, 1, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } }, [1] = { damageType = 1, areaEffect = 2, area = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 1, 2, 1, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } } } -- Função para empurrar uma criatura local function doPushCreature(target, cid) if target > 0 then if not isNpc(target) then local position = getThingPosition(cid) local fromPosition = getThingPosition(target) local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1)) local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1)) local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z} if doTileQueryAdd(target, toPosition) == 1 and not getTileInfo(toPosition).house then doTeleportThing(target, toPosition, true) end end end end spell.combats = {} for _, config in ipairs(spell.config) do local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType) setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4.7, 0) function onTargetCreature(cid, target) doPushCreature(target, cid) end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") setCombatArea(combat, createCombatArea(config.area)) table.insert(spell.combats, combat) end function onCastSpell(cid, var) for n = 1, #spell.combats do addEvent(doCombat, (n * 120), cid, spell.combats[n], var) end return true end
  19. Parece que o problema está relacionado ao fato de que os carpets estão sendo tratados como uma alteração no mapa em vez de decoração sobre o piso existente. Para corrigir isso, você pode modificar o script para garantir que os carpets sejam criados como decoração sobre o piso existente. Aqui está uma versão modificada do seu script que deve resolver o problema: local object_itemid = { -- Defina os IDs dos itens e suas transformações correspondentes aqui } function onUse(cid, item, frompos, item2, topos) local storage = 789561 local time = 1 local sendEffect = true -- true ou false local EffectId = 1 local item_from_table = object_itemid[item.itemid] if exhaustion.check(cid, storage) then return false end if item_from_table then if getPlayerGroupId(cid) == 1 then if item_from_table.premium and not isPremium(cid) then return true and doPlayerSendCancel(cid, "Voce nao e vip.") end end -- Verifica se o carpet será criado no local do player (useWith = true) ou na posição do item (useWith = false) local position = item_from_table.useWith and topos or frompos -- Cria o carpet como decoração sobre o piso existente local carpet = doCreateItem(item_from_table.transform_to, 1, position) -- Verifica se o efeito deve ser enviado if sendEffect then doSendMagicEffect(position, EffectId) end -- Remove o item usado para criar o carpet doRemoveItem(item.uid, 1) end return true and exhaustion.set(cid, storage, time) end Nesta versão modificada, o carpet é criado na posição do jogador se useWith for verdadeiro e na posição do item se for falso. Isso deve garantir que os carpets sejam tratados como decoração sobre o piso existente, em vez de uma alteração no mapa, e devem persistir após o reinício do servidor.
  20. function onLogin(cid) if isPlayer(cid) and isInArea({x = 100, y = 100, z = 7}, {x = 150, y = 150, z = 7}) then setGlobalStorageValue(1000, true) -- Marca que o jogador está na área de não-PvP end return true end function onLogout(cid) if isPlayer(cid) then setGlobalStorageValue(1000, false) -- Remove a marcação da área de não-PvP ao sair end return true end function onPvpAttack(cid, target) if getGlobalStorageValue(1000) then -- Verifica se o jogador está na área de não-PvP return false -- Impede o ataque PvP end return true end O evento onLogin é usado para marcar os jogadores que entraram na área de não-PvP. O evento onLogout é usado para remover a marcação quando o jogador sai da área. O evento onPvpAttack é acionado quando um jogador tenta atacar outro jogador. Ele verifica se o jogador está na área de não-PvP e, se estiver, impede o ataque PvP retornando false. Certifique-se de ajustar as coordenadas ({x = 100, y = 100, z = 7} e {x = 150, y = 150, z = 7}) para corresponder à área específica onde você deseja desativar o PvP. Além disso, o valor de 1000 na função setGlobalStorageValue é apenas um exemplo; você pode escolher qualquer valor que não esteja em uso em seu servidor.
  21. O erro que você está enfrentando indica que está tentando chamar uma função chamada getPlayerPremDays, mas ela não está definida em lugar nenhum do seu script. Isso está ocorrendo porque você está tentando verificar a quantidade de dias de premium de um jogador, mas o nome da função correta é getPlayerPremiumDays. Para corrigir isso, você só precisa corrigir o nome da função para getPlayerPremiumDays. Aqui está a correção: local vip = getPlayerPremiumDays(cid)
  22. O erro que você está vendo acontece porque o sistema não está encontrando um combate (ou seja, a variável combat) quando a função doCombat() é chamada dentro do evento temporizado. Isso ocorre porque o evento temporizado é executado após o término do efeito da guarda, e nesse momento, o combate associado à habilidade pode ter sido encerrado. Para corrigir isso, você pode verificar se o jogador ainda está sob o efeito da habilidade antes de executar o combate dentro do evento temporizado. Aqui está como você pode fazer isso: function onCastSpell(cid, var) local waittime = 20 -- Tempo de exhaustion local storage = 696002 if exhaustion.check(cid, storage) then local remainingTime = exhaustion.get(cid, storage) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) -- Efeito visual quando o jogador está cansado doPlayerSendTextMessage(cid, 20, "Voce esta cansado. Tempo restante: " .. remainingTime .. " segundos.") return false end exhaustion.set(cid, storage, waittime) local condition = createConditionObject(CONDITION_MANASHIELD) setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) doAddCondition(cid, condition) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) -- Efeito visual quando a guarda está alta doPlayerSendTextMessage(cid, 20, "Guarda alta!") addEvent(function() if isCreature(cid) then if getCreatureCondition(cid, CONDITION_MANASHIELD) then -- Verifica se a condição ainda está ativa local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, 12) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) doCombat(cid, combat, var) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) -- Efeito visual quando a guarda está aberta doPlayerSendTextMessage(cid, 20, "Sua guarda esta aberta") end end end, 10000) -- Este valor deve ser igual ao valor definido em setConditionParam para a duração do efeito return true end Com esta modificação, a função doCombat() só será chamada se o jogador ainda estiver sob o efeito da habilidade. Isso deve resolver o erro que você está enfrentando.
  23. El Rusher

    Jump Spell

    O seu script está no caminho certo, mas alguns ajustes são necessários para alcançar o comportamento desejado. Vou ajudá-lo a modificar o código para atingir o objetivo: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true) function onGetFormulaValues(cid, level, skill, attack, factor) local skillTotal, levelTotal = skill + attack, level / 5 return -(skillTotal / 3 + levelTotal), -(skillTotal + levelTotal) end setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function attackCreature(cid, target, var) if not isCreature(cid) or not isCreature(target) then return false end local playerPos = getCreaturePosition(cid) local targetPos = getCreaturePosition(target) if doCombat(cid, combat, var) == LUA_NO_ERROR then doTeleportThing(cid, targetPos) doSendMagicEffect(targetPos, 61) end return true end function onCastSpell(cid, var) local playerPos = getCreaturePosition(cid) local creatures = getSpectators(playerPos, 3, 3, false) if not creatures or #creatures == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Nenhum alvo válido encontrado.") return false end for _, target in ipairs(creatures) do if isCreature(target) and (isPlayer(target) or isMonster(target)) then addEvent(attackCreature, 100, cid, target, var) end end addEvent(doTeleportThing, 100 * #creatures, cid, playerPos) return true end Renomeei a função attack para attackCreature para refletir melhor sua função. Removi a variável validTargets, pois agora estamos atacando um alvo por vez e não armazenando múltiplos alvos. Adicionei um evento para teleportar o jogador de volta para a posição inicial após atacar todos os alvos. Corrigi o loop for em onCastSpell para chamar attackCreature para cada alvo, em vez de chamar attack diretamente. Adicionei uma verificação para garantir que apenas alvos válidos (jogadores ou monstros) sejam atacados. Adicionei uma verificação para garantir que pelo menos um alvo válido seja encontrado antes de prosseguir com a magia.
  24. Você pode implementar essa funcionalidade com o auxílio de armazenamento de valores de jogadores em Lua, usando a função os.time() para registrar o momento em que o comando foi usado e verificar se o período de "exaustão" passou. Aqui está um exemplo de como você pode fazer isso: function onSay(cid, words, param) if param == "!mudarpvp" then local timeLastChanged = getPlayerStorageValue(cid, 99999) or 0 -- Verifica quando foi a última mudança local currentTime = os.time() -- Obtém o tempo atual em segundos if currentTime - timeLastChanged < 86400 then -- Verifica se não passou 1 dia desde a última mudança doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ainda está em modo no-PvP. Aguarde mais um tempo para mudar novamente.") return true end if getPlayerStorageValue(cid, 100000) == 1 then -- Verifica se o jogador está atualmente em modo no-PvP doPlayerSetStorageValue(cid, 100000, 0) -- Modo PvP ativado doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você agora está em modo PvP. Outros jogadores podem atacá-lo.") else doPlayerSetStorageValue(cid, 100000, 1) -- Modo no-PvP ativado doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você agora está em modo no-PvP. Você está livre de ataques de outros jogadores.") end setPlayerStorageValue(cid, 99999, currentTime) -- Registra o momento da última mudança end return true end Neste exemplo: O jogador digita "!mudarpvp". O sistema verifica quanto tempo passou desde a última mudança de estado usando a diferença entre o tempo atual (os.time()) e o tempo registrado na última mudança. Se não passou 1 dia desde a última mudança, o jogador recebe uma mensagem indicando que ele deve esperar mais um tempo. Se passou 1 dia, o sistema muda o estado do jogador de PvP para no-PvP ou vice-versa, dependendo do estado atual. O sistema registra o tempo da última mudança para garantir que o jogador não possa mudar novamente até que tenha passado um dia desde a última mudança.
  25. function onUse(cid, item, fromPosition, itemEx, toPosition) local manaToRestore = 150 + (getPlayerMagLevel(cid) * 2) -- Calcula a quantidade de mana a ser restaurada doCreatureAddMana(cid, manaToRestore) -- Restaura a mana do jogador doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE) -- Efeito visual para indicar a restauração de mana doRemoveItem(item.uid, 1) -- Remove a mana rune do inventário do jogador return true end e nao menos importante: newItem = { itemid = 1234, -- ID da mana rune manaToRestore = 150, -- Quantidade fixa de mana a ser restaurada script = "rune_mana.lua" -- Nome do script que você criou }
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...