Postado Abril 22, 2024 1 ano 6 horas atrás, Mateus Robeerto disse: Esse script que eu postei é apenas para TFS 1x+, funcionando sem modificações no OTX/OTG misturado, e está tudo funcionando normalmente. O usuário @mane stick me procurou pelo Discord e, depois de pensar sobre isso, aceitei. Fiz as alterações necessárias para torná-lo compatível com OTX/OTG, e agora está funcionando perfeitamente. Ele disse que está tudo ok após os testes. data/scripts -- Definição das habilidades e suas características local skills = { ["magiclevel"] = {vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 3, incre = 1, skill = SKILL_MAGLEVEL}, ["skillclub"] = {vocations = {1, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, lim_msg = "Você não pode ter skill club acima de 350.", price= 1, incre = 1, skill = SKILL_CLUB}, ["skillsword"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, lim_msg = "Você não pode ter skill sword acima de 350.", price= 1, incre = 1, skill = SKILL_SWORD}, ["skillaxe"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, lim_msg = "Você não pode ter skill axe acima de 350.", price= 1, incre = 1, skill = SKILL_AXE}, ["skilldistance"] = {vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, lim_msg = "Você não pode ter skill distance acima de 350.", price= 1, incre = 1, skill = SKILL_DISTANCE}, ["skillshielding"] = {vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, lim_msg = "Você não pode ter skill shielding acima de 350.", price= 1, incre = 1, skill = SKILL_SHIELD}, ["magiclevel5"] = {vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode pode ter magic level acima de 200.", price= 15, incre = 5, skill = SKILL_MAGLEVEL}, ["skillclub10"] = {vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, lim_msg = "Você não pode ter skill club acima de 350.", price= 10, incre = 10, skill = SKILL_CLUB}, ["skillsword10"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, lim_msg = "Você não pode ter skill sword acima de 350.", price= 10, incre = 10, skill = SKILL_SWORD}, ["skillaxe10"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, lim_msg = "Você não pode ter skill axe acima de 350.", price= 10, incre = 10, skill = SKILL_AXE}, ["skilldistance10"] = {vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, lim_msg = "Você não pode ter skill distance acima de 350.", price= 10, incre = 10, skill = SKILL_DISTANCE}, ["skillshielding10"] = {vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, lim_msg = "Você não pode ter skill shielding acima de 350.", price= 10, incre = 10, skill = SKILL_SHIELD}, } -- Função para obter o nome da habilidade com base no ID local function getPlayerSkillName(skillId) local skillNames = { [SKILL_CLUB] = "Club", [SKILL_SWORD] = "Sword", [SKILL_AXE] = "Axe", [SKILL_DISTANCE] = "Distance", [SKILL_SHIELD] = "Shielding", [SKILL_MAGLEVEL] = "Magic Level" } return skillNames[skillId] or "Unknown" end local function buySkill(player, skillData) local coinID = 9971 -- ID da moeda utilizada para compra local storage = 45611 -- Valor de armazenamento para controle de tempo if player:getItemCount(coinID) < skillData.price then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não possui a quantidade necessária para comprar.") return false end local skillId = skillData.skill local skillName = getPlayerSkillName(skillId) local currentSkill if skillId == SKILL_MAGLEVEL then currentSkill = player:getMagicLevel() else currentSkill = player:getSkillLevel(skillId) end if currentSkill == nil then player:sendCancelMessage("Você não possui essa habilidade.") return false end if skillId == SKILL_MAGLEVEL then local newMagLevel = currentSkill + skillData.incre if newMagLevel > skillData.lim then player:sendCancelMessage(skillData.lim_msg) return false end local target = player target:addManaSpent(target:getVocation():getRequiredManaSpent(target:getBaseMagicLevel() + 1) - target:getManaSpent()) print("Player: " .. player:getName() .. " adquiriu " .. skillData.incre .. " níveis de magic level. Novo magic level: " .. newMagLevel) else local target = player target:addSkillTries(skillId, target:getVocation():getRequiredSkillTries(skillId, target:getSkillLevel(skillId) + 1) - target:getSkillTries(skillId)) print("Player: " .. player:getName() .. " adquiriu " .. skillData.incre .. " níveis em " .. skillName) end if not isInArray(skillData.vocations, player:getVocation():getId()) then player:sendCancelMessage(skillData.voc_msg) return false end player:removeItem(coinID, skillData.price) player:setStorageValue(storage, os.time() + 1) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você comprou " .. skillData.incre .. " níveis em " .. skillName .. " por " .. skillData.price .. " moedas.") return true end local buyComprar = TalkAction("!comprar") function buyComprar.onSay(player, words, param) local param = param:lower() local tile = player:getTile() if not tile or not tile:hasFlag(TILESTATE_PROTECTIONZONE) then player:sendCancelMessage("Você precisa estar em área protegida para utilizar este comando.") return false end local storage = 45611 -- Valor de armazenamento para controle de tempo if player:getStorageValue(storage) >= os.time() then player:sendCancelMessage("Por medidas de segurança você só pode utilizar este comando em " .. (player:getStorageValue(storage) - os.time()) .. " segundos.") return false end if param == "" or not skills[param] then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Comando inválido ou habilidade não encontrada. Use !comprar <habilidade> para comprar.") return false end local skillData = skills[param] local playerVocation = player:getVocation():getId() if not isInArray(skillData.vocations, playerVocation) then player:sendCancelMessage("Sua vocação não pode comprar essa habilidade.") return false end return buySkill(player, skillData) end buyComprar:separator(" ") buyComprar:register() testado e aprovado, funcionado 100%, você é top @Mateus Robeerto
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.