Ir para conteúdo

L3K0T

Membro
  • Registro em

  • Última visita

Tudo que L3K0T postou

  1. function onSay(cid, words, param, channel) local t = {} for i = 1, getPlayerInstantSpellCount(cid) do local spell = getPlayerInstantSpellInfo(cid, i - 1) if(spell.mlevel ~= 1) then if(spell.manapercent > 0) then spell.mana = spell.manapercent .. "%" end table.insert(t, spell) end end table.sort(t, function(a, b) return a.mlevel < b.mlevel end) local text, 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 doShowTextDialog(cid, 2175, text) return true end
  2. L3K0T postou uma resposta no tópico em Suporte Tibia OTServer
    <?php if (!defined('INITIALIZED')) exit; // Função para verificar se é hora de resetar os highscores function deveResetarHighscores() { // Coloque aqui a lógica para determinar se é hora de resetar os highscores // Por exemplo, verificar se passou uma certa quantidade de tempo desde o último reset // Retorne true se for hora de resetar, caso contrário, retorne false $lastResetTimestamp = /* Coloque aqui o timestamp do último reset */; $interval = 5 * 60; // 5 minutos em segundos $currentTimestamp = time(); // Verifica se passou o intervalo de tempo definido desde o último reset return ($currentTimestamp - $lastResetTimestamp) >= $interval; } // Função para resetar os highscores function resetarHighscores() { // Coloque aqui a lógica para resetar os highscores // Por exemplo, atualizar os valores na base de dados ou em outro sistema de armazenamento // Certifique-se de realizar as operações necessárias para reiniciar os highscores conforme sua lógica de negócios } $list = 'experience'; if (isset($_REQUEST['list'])) $list = $_REQUEST['list']; $page = 0; if (isset($_REQUEST['page'])) $page = min(50, $_REQUEST['page']); $vocation = ''; if (isset($_REQUEST['vocation'])) $vocation = $_REQUEST['vocation']; switch ($list) { case "fist": $id = Highscores::SKILL_FIST; $list_name = 'Fist Fighting'; break; case "club": $id = Highscores::SKILL_CLUB; $list_name = 'Club Fighting'; break; case "sword": $id = Highscores::SKILL_SWORD; $list_name = 'Sword Fighting'; break; case "axe": $id = Highscores::SKILL_AXE; $list_name = 'Axe Fighting'; break; case "distance": $id = Highscores::SKILL_DISTANCE; $list_name = 'Distance Fighting'; break; case "shield": $id = Highscores::SKILL_SHIELD; $list_name = 'Shielding'; break; case "fishing": $id = Highscores::SKILL_FISHING; $list_name = 'Fishing'; break; case "magic": $id = Highscores::SKILL__MAGLEVEL; $list_name = 'Magic'; break; default: $id = Highscores::SKILL__LEVEL; $list_name = 'Experience'; break; } $world_name = $config['server']['serverName']; $offset = $page * 100; $skills = new Highscores($id, 100, $page, $vocation); $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><IMG SRC="'.$layout_name.'/images/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD><CENTER><H2>Ranking for '.htmlspecialchars($list_name).' on '.htmlspecialchars($world_name).'</H2></CENTER><BR>'; $main_content .= '<br><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=whites><B>Rank</B></TD><TD WIDTH=75% CLASS=whites><B>Name</B></TD><TD WIDTH=15% CLASS=whites><b><center>Level</center></B></TD>'; if ($list == "experience") $main_content .= '<TD CLASS=whites><b><center>Experience</center></B></TD>'; $main_content .= '</TR>'; $number_of_rows = 0; foreach ($skills as $skill) { if ($list == "magic") $value = $skill->getMagLevel(); elseif ($list == "experience") $value = $skill->getLevel(); else $value = $skill->getScore(); $bgcolor = (($number_of_rows++ % 2 == 1) ? $config['site']['darkborder'] : $config['site']['lightborder']); $main_content .= '<tr bgcolor="'.$bgcolor.'"><td style="text-align:right">'.($offset + $number_of_rows).'.</td><td><a href="?subtopic=characters&name='.urlencode($skill->getName()).'">'.($skill->getOnline() > 0 ? "<font color=\"green\">".htmlspecialchars($skill->getName())."</font>" : "<font color=\"red\">".htmlspecialchars($skill->getName())."</font>").'</a><br><small>'.$skill->getLevel().' '.htmlspecialchars(Website::getVocationName($skill->getVocation())).'</small></td><td><center>'.$value.'</center></td>'; if ($list == "experience") $main_content .= '<td><center>'.$skill->getExperience().'</center></td>'; $main_content .= '</tr>'; } $main_content .= '</TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>'; if ($page > 0) $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.urlencode($list).'&page='.($page - 1).'&vocation=' . urlencode($vocation) . '" CLASS="size_xxs">Previous Page</A></TD></TR>'; if ($page < 50) $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.urlencode($list).'&page='.($page + 1).'&vocation=' . urlencode($vocation) . '" CLASS="size_xxs">Next Page</A></TD></TR>'; $main_content .= '</TABLE></TD><TD WIDTH=5%><IMG SRC="'.$layout_name.'/images/blank.gif" WIDTH=1 HEIGHT=1 BORDER=0></TD><TD WIDTH=15% VALIGN=top ALIGN=right><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=whites><B>Choose a skill</B></TD></TR><TR BGCOLOR="'.$config['site']['lightborder'].'"><TD><A HREF="?subtopic=highscores&list=experience" CLASS="size_xs">Experience</A><BR><A HREF="?subtopic=highscores&list=magic" CLASS="size_xs">Magic</A><BR><A HREF="?subtopic=highscores&list=shield" CLASS="size_xs">Shielding</A><BR><A HREF="?subtopic=highscores&list=distance" CLASS="size_xs">CLASS="size_xs">Distance</A><BR><A HREF="?subtopic=highscores&list=club" CLASS="size_xs">Club</A><BR><A HREF="?subtopic=highscores&list=sword" CLASS="size_xs">Sword</A><BR><A HREF="?subtopic=highscores&list=axe" CLASS="size_xs">Axe</A><BR><A HREF="?subtopic=highscores&list=fist" CLASS="size_xs">Fist</A><BR><A HREF="?subtopic=highscores&list=fishing" CLASS="size_xs">Fishing</A><BR></TD></TR></TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>'; // Verifica se é hora de resetar os highscores if (deveResetarHighscores()) { // Reseta os highscores resetarHighscores(); } ?>
  3. Lib function table.unserialize(str) if(type(str) ~= 'string' or str:len() == 0) then return {} end return loadstring("return " .. str)() end
  4. local POLL_STORAGE = 80000 local OPTIONS_STORAGE = 80001 local PLAYER_STORAGE = 80000 function table.serialize(tbl) local str = "{" local sep = "" for k, v in pairs(tbl) do str = str .. sep if type(k) == "number" then str = str .. "[" .. k .. "]" else str = str .. k end str = str .. "=" if type(v) == "table" then str = str .. table.serialize(v) elseif type(v) == "number" or type(v) == "boolean" then str = str .. tostring(v) else str = str .. string.format("%q", v) end sep = "," end str = str .. "}" return str end local function getTotalVotes() local options = table.unserialize(getStorage(OPTIONS_STORAGE)) local amount = 0 for _, option in ipairs(options) do amount = amount + option[2] end return amount end local function getMostVotedOption() local options = table.unserialize(getStorage(OPTIONS_STORAGE)) local value, ret = 0, {} for _, option in ipairs(options) do if option[2] > value then value = option[2] ret = {option[1]} elseif option[2] == value then table.insert(ret, option[1]) end end return ret end function onSay(cid, words, param, channel) param = param or "" if param == "" and not words == "/poll" then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command ".. words .." need parameters.") end local parameters, vote = {} if(words == "/newpoll") then if getStorage(POLL_STORAGE) ~= -1 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but there is a poll in progress.\nIf you want to start a new poll, type /endpoll.") end parameters = string.explode(param, ",") if #parameters < 3 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command /newpoll needs a poll and at least two options.") end if parameters[1] then local options = {} for i = 2, #parameters do table.insert(options, {parameters[i], 0}) end if #options < 2 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Insert at least two options after the poll") end doSetStorage(POLL_STORAGE, parameters[1]) options = table.serialize(options) doSetStorage(OPTIONS_STORAGE, options) doBroadcastMessage("A new poll is in progress with the title '".. getStorage(POLL_STORAGE) .."?'!\nSee the status with /poll and vote with /vote.") end elseif(words == "/vote") then vote = tonumber(param) or -1 local options = table.unserialize(getStorage(OPTIONS_STORAGE)) if getStorage(POLL_STORAGE) == -1 then return doPlayerSendCancel(cid, "There is not a poll in progress.") end if vote == -1 then return doPlayerSendCancel(cid, "You need to choose a option to vote.") end if getCreatureStorage(cid, PLAYER_STORAGE) == 1 then print(getCreatureStorage(cid, PLAYER_STORAGE)) return doPlayerSendCancel(cid, "You cannot vote two times.") end if vote > #options then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) end options[vote][2] = options[vote][2] + 1 doSetStorage(OPTIONS_STORAGE, table.serialize(options)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have voted in the option ".. options[vote][1] .." successfully!") doCreatureSetStorage(cid, PLAYER_STORAGE, 1) elseif(words == "/poll") then local options = table.unserialize(getStorage(OPTIONS_STORAGE)) if getStorage(POLL_STORAGE) == -1 then return doPlayerSendCancel(cid, "There is not a poll in progress.") end local text = "ADVANCED poll SYSTEM\n\n".. getStorage(POLL_STORAGE) .."?\n" local count = 1 for _, option in ipairs(options) do text = text .."\n#".. count .." ".. option[1] .." ".. (getTotalVotes() == 0 and 0 or math.floor((option[2]/getTotalVotes()) * 100)) .."%\n" count = count + 1 end doPlayerPopupFYI(cid, text) elseif(words == "/endpoll") then if getStorage(POLL_STORAGE) == -1 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is not a poll to be ended.") end if not getMostVotedOption() then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait at least one vote to end this poll.") end local mostVotedOptions = getMostVotedOption() local mostVotedText = table.concat(mostVotedOptions, ", ") doBroadcastMessage("The poll '".. getStorage(POLL_STORAGE) .."?' has been finished!\nThe most voted option(s) was/were: ".. mostVotedText ..".") doSetStorage(POLL_STORAGE, -1) doSetStorage(OPTIONS_STORAGE, -1) for _, player in ipairs(getPlayersOnline()) do doCreatureSetStorage(player, PLAYER_STORAGE, -1) end db.executeQuery("UPDATE `player_storage` SET value = -1 WHERE `key` = ".. PLAYER_STORAGE ..";") end return true end
  5. local POLL_STORAGE = 80000 local OPTIONS_STORAGE = 80001 local PLAYER_STORAGE = 80000 local function getTotalVotes() local options = table.unserialize(getStorage(OPTIONS_STORAGE)) local amount = 0 for _, option in ipairs(options) do amount = amount + option[2] end return amount end local function getMostVotedOption() local options = table.unserialize(getStorage(OPTIONS_STORAGE)) local value, ret = 0, {} -- Inicialize ret as an empty table for _, option in ipairs(options) do if option[2] > value then value = option[2] ret = {option[1]} -- Wrap option[1] in a table elseif option[2] == value then table.insert(ret, option[1]) -- Add option[1] to ret if it has the same value as the current max end end return ret end function onSay(cid, words, param, channel) param = param or "" if param == "" and not words == "/poll" then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command ".. words .." need parameters.") end local parameters, vote = {} if(words == "/newpoll") then if getStorage(POLL_STORAGE) ~= -1 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but there is a poll in progress.\nIf you want to start a new poll, type /endpoll.") end parameters = string.explode(param, ",") if #parameters < 3 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The command /newpoll needs a poll and at least two options.") end if parameters[1] then local options = {} for i = 2, #parameters do table.insert(options, {parameters[i], 0}) end if #options < 2 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Insert at least two options after the poll") end doSetStorage(POLL_STORAGE, parameters[1]) options = table.serialize(options) doSetStorage(OPTIONS_STORAGE, options) doBroadcastMessage("A new poll is in progress with the title '".. getStorage(POLL_STORAGE) .."?'!\nSee the status with /poll and vote with /vote.") end elseif(words == "/vote") then vote = tonumber(param) or -1 local options = table.unserialize(getStorage(OPTIONS_STORAGE)) if getStorage(POLL_STORAGE) == -1 then return doPlayerSendCancel(cid, "There is not a poll in progress.") end if vote == -1 then return doPlayerSendCancel(cid, "You need to choose a option to vote.") end if getCreatureStorage(cid, PLAYER_STORAGE) == 1 then print(getCreatureStorage(cid, PLAYER_STORAGE)) return doPlayerSendCancel(cid, "You cannot vote two times.") end if vote > #options then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) end options[vote][2] = options[vote][2] + 1 doSetStorage(OPTIONS_STORAGE, table.serialize(options)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have voted in the option ".. options[vote][1] .." successfully!") doCreatureSetStorage(cid, PLAYER_STORAGE, 1) elseif(words == "/poll") then local options = table.unserialize(getStorage(OPTIONS_STORAGE)) if getStorage(POLL_STORAGE) == -1 then return doPlayerSendCancel(cid, "There is not a poll in progress.") end local text = "ADVANCED poll SYSTEM\n\n".. getStorage(POLL_STORAGE) .."?\n" local count = 1 for _, option in ipairs(options) do text = text .."\n#".. count .." ".. option[1] .." ".. (getTotalVotes() == 0 and 0 or math.floor((option[2]/getTotalVotes()) * 100)) .."%\n" count = count + 1 end doPlayerPopupFYI(cid, text) elseif(words == "/endpoll") then if getStorage(POLL_STORAGE) == -1 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is not a poll to be ended.") end if not getMostVotedOption() then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wait at least one vote to end this poll.") end local mostVotedOptions = getMostVotedOption() local mostVotedText = table.concat(mostVotedOptions, ", ") doBroadcastMessage("The poll '".. getStorage(POLL_STORAGE) .."?' has been finished!\nThe most voted option(s) was/were: ".. mostVotedText ..".") doSetStorage(POLL_STORAGE, -1) doSetStorage(OPTIONS_STORAGE, -1) for _, player in ipairs(getPlayersOnline()) do doCreatureSetStorage(player, PLAYER_STORAGE, -1) end db.executeQuery("UPDATE `player_storage` SET value = -1 WHERE `key` = ".. PLAYER_STORAGE ..";") end return true end function table.unserialize(str) if type(str) ~= 'string' or str:len() == 0 then return {} end local f = load("return " .. str) if f then return f() else return {} end end
  6. Coloca imagens por gentileza?? Scan e remova links de mensagens pessoais
  7. Top no final pra deixar melhorzinha explicado function onOpenRuleViolation(cid, message) -- Configuração do Telegram local config = { token = "", -- Token do seu BOT no Telegram chatId = "" -- ID do chat do Telegram que receberá a notificação. } -- Construção da mensagem com o nome do jogador e o relatório local playerName = getCreatureName(cid) local formattedMessage = "Player: " .. playerName .. "\n\nReport:\n" .. message -- Substitui quebras de linha por '%0A' para o formato adequado na URL formattedMessage = string.gsub(formattedMessage, "\n", "%%0A") -- Construção da URL de requisição para o Telegram local apiUrl = "https://api.telegram.org/bot" .. config.token .. "/sendMessage" local requestData = "chat_id=" .. config.chatId .. "&text=" .. formattedMessage -- Execução da requisição usando o comando 'curl' local curlCommand = io.popen('curl -d "' .. requestData .. '" "' .. apiUrl .. '"'):read("*a") return true end function onLogin(cid) -- Registro do evento para notificação de violação de regra registerCreatureEvent(cid, "openNotifyRuleViolation") return true end
  8. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local item1 = 123 -- item local qntd1 = 1 -- quantia local stor = 1023332 local function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end local function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end local function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end local function onThink() npcHandler:onThink() end local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = npcHandler:isConvincing() and 0 or cid if msgcontains(msg, 'entregar') then selfSay('Voce conseguiu mesmo juntar os itens? Diga {sim} se deseja me entregar', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'sim') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, stor) > 0 then selfSay('Voce ja realizou a troca comigo.', cid) else if getPlayerItemCount(cid, item1) >= qntd1 then doPlayerRemoveItem(cid, item1, qntd1) local bag = doPlayerAddItem(cid, 1599, 1) doAddContainerItem(bag, 2190, 10) setPlayerStorageValue(cid, stor, 1) selfSay('Obrigado! Em troca, aqui esta o seu premio.', cid) else selfSay('Voce ainda nao conseguiu os requisitos. Estou ansioso por eles, ha tantas utilidades.', cid) end end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  9. Acho que é a base pokémon Zring
  10. function onUse(player, item, fromPosition, target, toPosition, isHotkey) local pid = getPlayerGUID(player) local resetSystem = { back_to_level = 500, Reset = { [1] = {needed_level = 15000, damage_percent = 2}, [2] = {needed_level = 16000, damage_percent = 4}, [3] = {needed_level = 16500, damage_percent = 6}, [4] = {needed_level = 16700, damage_percent = 8}, [5] = {needed_level = 20000, damage_percent = 10}, [6] = {needed_level = 20000, damage_percent = 12}, [7] = {needed_level = 20000, damage_percent = 14}, [8] = {needed_level = 20000, damage_percent = 16}, [9] = {needed_level = 20000, damage_percent = 18}, [10] = {needed_level = 21000, damage_percent = 20}, [11] = {needed_level = 21000, damage_percent = 22}, [12] = {needed_level = 21000, damage_percent = 24}, [13] = {needed_level = 21000, damage_percent = 26}, [14] = {needed_level = 21000, damage_percent = 28}, [15] = {needed_level = 22500, damage_percent = 30}, [16] = {needed_level = 24000, damage_percent = 32}, [17] = {needed_level = 25500, damage_percent = 34}, [18] = {needed_level = 27000, damage_percent = 36}, [19] = {needed_level = 28500, damage_percent = 38}, [20] = {needed_level = 30000, damage_percent = 40}, [21] = {needed_level = 31500, damage_percent = 42}, [22] = {needed_level = 33000, damage_percent = 44}, [23] = {needed_level = 34500, damage_percent = 46}, [24] = {needed_level = 36000, damage_percent = 48}, [25] = {needed_level = 37500, damage_percent = 50}, [26] = {needed_level = 39000, damage_percent = 52}, [27] = {needed_level = 40500, damage_percent = 54}, [28] = {needed_level = 42000, damage_percent = 56}, [29] = {needed_level = 43500, damage_percent = 58}, [30] = {needed_level = 45000, damage_percent = 60}, [31] = {needed_level = 46500, damage_percent = 62}, [32] = {needed_level = 48000, damage_percent = 64}, [33] = {needed_level = 49500, damage_percent = 66}, [34] = {needed_level = 51000, damage_percent = 68}, [35] = {needed_level = 52500, damage_percent = 70}, [36] = {needed_level = 54000, damage_percent = 72}, [37] = {needed_level = 55500, damage_percent = 74}, [38] = {needed_level = 57000, damage_percent = 76}, [39] = {needed_level = 58500, damage_percent = 78}, [40] = {needed_level = 60000, damage_percent = 80}, [41] = {needed_level = 61500, damage_percent = 82}, [42] = {needed_level = 63000, damage_percent = 84}, [43] = {needed_level = 64500, damage_percent = 86}, [44] = {needed_level = 66000, damage_percent = 88}, [45] = {needed_level = 67500, damage_percent = 90}, [46] = {needed_level = 69000, damage_percent = 92}, [47] = {needed_level = 70500, damage_percent = 94}, [48] = {needed_level = 72000, damage_percent = 96}, [49] = {needed_level = 73500, damage_percent = 98}, [50] = {needed_level = 75000, damage_percent = 100}, [51] = {needed_level = 80000, damage_percent = 102}, [52] = {needed_level = 85000, damage_percent = 104}, [53] = {needed_level = 90000, damage_percent = 106}, [54] = {needed_level = 100000, damage_percent = 108}, [55] = {needed_level = 110000, damage_percent = 110}, [56] = {needed_level = 130000, damage_percent = 112}, [57] = {needed_level = 150000, damage_percent = 114}, [58] = {needed_level = 170000, damage_percent = 116}, [59] = {needed_level = 180000, damage_percent = 118}, [60] = {needed_level = 200000, damage_percent = 120}, } } local function getInfo(pid) return resetSystem.Reset[1] -- Sempre obtém o bônus da primeira entrada end local function addBonuses(pid) local bonus = getInfo(pid) if (bonus and bonus.damage_percent) then setPlayerDamageMultiplier(pid, getPlayerDamageMultiplier(pid) + (bonus.damage_percent / 100.0)) local mensagem = "[SISTEMA DE BÔNUS]\nVocê recebeu um bônus de +" .. bonus.damage_percent .. "% de dano." doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, mensagem) doRemoveItem(item.uid, 1) end end addBonuses(pid) return true end
  11. local config = { monsters = {"The Mega Boss Rox"}, rewards = { {itemID = 2160, chanceToGainInPercent = 3, quantity = 100}, {itemID = 2148, chanceToGainInPercent = 3, quantity = 100}, }, effect = 27, backpackID = 2853, -- ID da mochila, ajuste conforme necessário } -- 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) and getCreatureMaster(target) == nil then local monsterNameKilled = getCreatureName(target) if isInArray(config.monsters, monsterNameKilled) then local selectedItem = selectRandomItem() local backpack = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK) if backpack.uid > 0 then doAddContainerItem(backpack.uid, selectedItem.itemID, selectedItem.quantity) doSendMagicEffect(getCreaturePosition(cid), config.effect) doBroadcastMessage("Mataram o boss.", 19) else print("O jogador não possui uma mochila equipada.") end end end return true end function onLogin(cid) registerCreatureEvent(cid, "killTheBoss") return true end
  12. Sempre Jair kk
  13. L3K0T postou uma resposta no tópico em Suporte Tibia OTServer
    -- Lista de eventos com seus respectivos horários local EventsListalist = { {time = "08:00", name = "Bomberman Event"}, {time = "09:00", name = "Desert War"}, {time = "10:00", name = "Snowball War"}, {time = "11:00", name = "Capture The Flag"}, {time = "12:00", name = "Battlefield Event"}, {time = "13:00", name = "Zombie Event"}, {time = "14:00", name = "Desert War"}, {time = "15:00", name = "Snowball War"}, {time = "16:00", name = "Battlefield Event"}, {time = "17:00", name = "Capture The Flag"}, {time = "18:00", name = "Zombie Event"}, {time = "19:00", name = "Real Castle"}, {time = "21:00", name = "Capture The Flag"}, {time = "22:00", name = "Battlefield Event"}, {time = "22:30", name = "Bomberman Event"}, {time = "23:00", name = "Zombie Event"}, {time = "00:00", name = "Capture The Flag"}, {time = "01:00", name = "Snowball War"}, {time = "02:00", name = "Desert War"}, {time = "03:00", name = "Bomberman Event"} } -- Posição onde os eventos serão anunciados local position = {x = 708, y = 235, z = 7} -- Função para converter o horário de formato "HH:MM" para minutos function hourToNumber(hour) local pattern = "(%d+):(%d+)" local hours, minutes = hour:match(pattern) return tonumber(hours) * 60 + tonumber(minutes) end -- Função para formatar a diferença de tempo em "HH:MM" function timeString(minutes) local hours = math.floor(minutes / 60) local remainingMinutes = minutes % 60 return string.format("%02d:%02d", hours, remainingMinutes) end -- Função chamada a cada intervalo de tempo function onThink(interval, lastExecution) -- Obtém a lista de jogadores online local people = getPlayersOnline() -- Se não houver jogadores online, retorna if #people == 0 then return true end -- Inicializa a contagem local Count = 0 -- Itera sobre a lista de eventos for _, t in ipairs(EventsListalist) do -- Converte os horários dos eventos e o horário atual para minutos local eventTime = hourToNumber(t.time) local realTime = hourToNumber(os.date("%H:%M")) -- Se o horário do evento for maior ou igual ao horário atual if eventTime >= realTime then -- Anuncia o próximo evento e a diferença de tempo doPlayerSay(people[1], "Próximo evento às {"..t.time.."}, "..t.name..", faltam "..timeString(eventTime - realTime)..".", TALKTYPE_MONSTER_SAY, false, 0, position) return true end -- Incrementa a contagem Count = Count + 1 end -- Retorna verdadeiro return true end
  14. L3K0T postou uma resposta no tópico em Suporte Tibia OTServer
    Sim! não é recomendado, pois pode afetar o desempenho e a estabilidade do servidor.
  15. local damageTable = { {4, -3}, -- Quantidade / dano {9, -2}, {20, -1} } local function createExplosion() local explosion = createConditionObject(CONDITION_FIRE) setConditionParam(explosion, CONDITION_PARAM_DELAYED, 1) for i = 1, #damageTable do local t = damageTable[i] addDamageCondition(explosion, t[1], 1000, t[2]) -- tempo end return explosion end local function explodeCreature(creature) if isCreature(creature) then local explosion = createExplosion() local area = createCombatArea({{1, 1, 1}}) doAreaCombatHealth(creature, 1, getThingPos(creature), area, -1, -30, 5) doAreaCombatCondition(creature, getThingPos(creature), area, explosion, 255) doSendMagicEffect(getThingPos(creature), CONST_ME_EXPLOSIONAREA) end end function onDeath(creature, corpse, killer) if isSummon(creature) or isMonster(creature) then addEvent(explodeCreature, 1, creature) end return true end
  16. Internet.... Não vale a pena perder tempo com pessoas assim, rsrs. Eu nem responderia. Prefiro dizer: 'Seja feliz, a vida continua'. Manter a confiança e a amizade é precioso, e acredito que você agiu da maneira ???. Ainda por cima, o mesmo ameaçando? Que atitude feia... Perturbação do sossego e fazendo injúria, realmente tenso. A única coisa que ninguém pode tirar de você é o conhecimento, haha. Boa noite e espero que tudo fique bem pra vocês *se puder remover os palavrão do seu texto... deixa algo mais saudável
  17. local explosion = createConditionObject(CONDITION_FIRE) setConditionParam(explosion, CONDITION_PARAM_DELAYED, 1) local damageTable = { {4, -3}, -- Quantidade / dano {9, -2}, {20, -1} } for i = 1, #damageTable do local t = damageTable[i] addDamageCondition(explosion, t[1], 1000, t[2]) -- tempo end local arr = { {1, 1, 1}, {1, 3, 1}, {1, 1, 1} } local area = createCombatArea(arr) function onDeath(cid, corpse, killer) if isCreature(cid) then if isSummon(cid) or isMonster(cid) then doAreaCombatHealth(cid, 1, getThingPos(cid), area, -1, -30, 5) doAreaCombatCondition(cid, getThingPos(cid), area, explosion, 255) doSendMagicEffect(getThingPos(cid), CONST_ME_EXPLOSIONAREA) end end return true end
  18. então, não adianta usar chat gpt, se não souber o que ele escreveu... precisa analisar os codigo e traduzir na sua mente, agora se não entende o que ele escreveu é = tiro no escuro. e seu código não está em lua tbm oque mandou e sim em python mande o arquivo .lua do exp...
  19. local explosion = createConditionObject(CONDITION_FIRE) setConditionParam(explosion, CONDITION_PARAM_DELAYED, 1) local damageTable = { {4, -3}, -- Quantidade / dano {9, -2}, {20, -1} } for i = 1, #damageTable do local t = damageTable[i] addDamageCondition(explosion, t[1], 1000, t[2]) -- tempo end local arr = { {1, 1, 1}, {1, 3, 1}, {1, 1, 1} } local area = createCombatArea(arr) function onDeath(cid, corpse, killer) if isMonster(cid) then doAreaCombatHealth(cid, 1, getThingPos(cid), area, -1, -30, 5) doAreaCombatCondition(cid, getThingPos(cid), area, explosion, 255) doSendMagicEffect(getThingPos(cid), CONST_ME_EXPLOSIONAREA) -- Alterado para efeito de explosão end return true end
  20. Embora o script esteja funcionando corretamente, parece que a tabela no banco de dados não está registrando a experiência conforme esperado. A mensagem atual indica isso porque a tabela está com valor 0 ou nulo, impossibilitando a recuperação de experiência. Isso pode estar relacionado a outro sistema que registra a experiência do jogador no banco de dados. "Pedimos desculpas, mas você não pode recuperar a experiência perdida no momento, pois não há registro disponível!"
  21. no config nao tem isso ou algo... aperta ctrl+f dentro do config e digita party pelo enter e ve que aparece de party? EnableExtraPartyEXP = true
  22. expbuy 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 local DEATH_TABLE = { before_exp = 0, after_exp = 0 } 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, 5 -- Edit the item id and count here if isInArray({"recover", "recuperar", "exp", "experience"}, msg) then npcHandler:say("Do you want to recover lost experience after your death for " .. 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 expToRestore = getPlayerStorageValue(cid, DEATH_TABLE.before_exp) - getPlayerStorageValue(cid, DEATH_TABLE.after_exp) doPlayerAddExp(cid, expToRestore) npcHandler:say("Thank you! Here is your experience.", cid) else npcHandler:say("Sorry, you don't have enough " .. getItemNameById(itemid) .. "!", cid) end else npcHandler:say("Sorry, you didn't die or have already recovered your lost experience.", 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()) expbuy otimizado local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local DEATH_TABLE = { before_exp = 0, after_exp = 0 } 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, 5 -- Edite o ID e a quantidade do item aqui if isInArray({"recover", "recuperar", "exp", "experience"}, msg) then npcHandler:say("Deseja recuperar a experiência perdida após sua morte por " .. count .. " " .. getItemNameById(itemid) .. "? {yes}", cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then local beforeExp = getPlayerStorageValue(cid, DEATH_TABLE.before_exp) local afterExp = getPlayerStorageValue(cid, DEATH_TABLE.after_exp) local playerExp = getPlayerExperience(cid) if beforeExp ~= -1 and playerExp < beforeExp then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local expToRestore = beforeExp - afterExp doPlayerAddExp(cid, expToRestore) npcHandler:say("Obrigado! Aqui está sua experiência perdida de volta.", cid) else npcHandler:say("Desculpe, você não tem itens suficientes " .. getItemNameById(itemid) .. "!", cid) end else npcHandler:say("Desculpe, você não morreu ou já recuperou sua experiência perdida!", cid) end talkState[talkUser] = 0 elseif msg == "no" then npcHandler:say("Então, não.", cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())

Informação Importante

Confirmação de Termo