Postado Maio 13, 2023 2 anos Administrador Em 09/05/2023 em 16:39, Vitorelias disse: .Qual servidor ou website você utiliza como base? TFS 1.4 Qual o motivo deste tópico? O script funciona porem precisaria fazer alguns ajustes e correção o Script foi feito pelo Vodkart, precisaria ajustar algumas coisas. Bom o script você consegue utilizar o comando adiciona skill para o Player, porem o limite de compra é 350. só que usando o comando só vai até 208 ou é 202 para skill fist, club, distance, axe, e sword. já o magic level, o maximo que vai é 156 mais pelo comando teria que chegar até 200. o script talvez teria que colocar por db não sei ao certo mais o script funciona porem tem esses problema db.query("UPDATE " .. db_table .. " SET " .. db_set_column .. " = " .. (db_skill_value + db_skill_value_sum) .. " WHERE id = " .. player:getGuid() .. ";") Está surgindo algum erro? Se sim coloque-o aqui. Você tem o código disponível? Se tiver publique-o aqui: SKILL_CLUB = "skill_club" SKILL_DISTANCE = "skill_dist" SKILL_SHIELD = "skill_shielding" SKILL_MAGLEVEL = "maglevel" SKILL_SWORD = "skill_sword" SKILL_AXE = "skill_axe" local buyComprar = TalkAction("!comprar") local storage = 45611 local coinID = 9971 -- moeda para comprar skills 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 = 7}, ["skillclub"] = {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= 1, incre = 1, skill = 1}, ["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 = 2}, ["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 = 3}, ["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 = 4}, ["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 = 5}, ["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 = 7}, ["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 = 1}, ["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 = 2}, ["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 = 3}, ["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 = 4}, ["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 = 5}, } function buyComprar.onSay(player, words, param) local player = Player(player) local pid = player:getGuid() local tile = player:getTile() local param = param:lower() if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then player:sendCancelMessage("Você precisa estar em área protegida para utilizar este comando.") return true end 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 true end if param == "" then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nmontaria shadow draptor = montaria shadow draptor por 30 barras.\nmontaria golden lion = montaria golden lion por 30 barras.\nmontaria winter king = montaria winter king por 30 barras.\nmontaria flying divan = montaria flying divan por 30 barras.\nmontaria woodland prince = montaria woodland prince por 30 barras.\nmontaria black stag = montaria black stag por 30 barras.\nmontaria nether steed = montaria nether steed por 30 barras.\nmontaria snow pelt = montaria snow pelt por 30 barras.\nmontaria slagsnare = montaria slagsnare por 30 barras.\nmontaria sea devil = montaria sea devil por 55 barras.\nmontaria highland yak = montaria highland yak por 75 barras.\nmontaria copper fly = montaria copper fly por 60 barras.\nmontaria bloodcurl = montaria bloodcurl por 70 barras.\nmontaria poisonbane = montaria poisonbane por 65 barras.\nmontaria razorcreep = montaria razorcreep por 75 barras.\nmontaria noctungra = montaria noctungra por 70 barras.\nmontaria leafscuttler = montaria leafscuttler por 75 barras.\nmontaria jade pincer = montaria jade pincer por 60 barras.\nmontaria frostflare = montaria frostflare por 85 barras.\nroupa conjurer = roupa conjurer todos addons por 30 barras\nroupa ceremonial garb = roupa ceremonial garb todos addons por 30 barras.\nroupa puppeteer = roupa puppeteer todos addons por 30 barras.\nroupa death herald = roupa death herald todos addons por 30 barras.\nroupa winter warden = roupa winter warden todos addons por 30 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponível.") return true end if skills[param] then local v = skills[param] if param == "magiclevel" and player:getBaseMagicLevel() >= v.lim or (player:getBaseMagicLevel() + v.incre ) >= v.lim then player:sendCancelMessage(v.lim_msg) return true elseif player:getSkillLevel(v.skill) + v.incre >= v.lim then player:sendCancelMessage(v.lim_msg) return true end if not isInArray(v.vocations, player:getVocation():getId()) then player:sendCancelMessage(v.voc_msg) return true end if player:getItemCount(coinID) >= v.price then player:removeItem(coinID, v.price) player:setStorageValue(storage, os.time()+1) local skillId = v.skill local amount = v.incre for i = 1, amount do local curSkill = player:getSkillLevel(skillId) local curTries = player:getSkillTries(skillId) local voc = player:getVocation() local nextTries = voc:getRequiredSkillTries(skillId, curSkill + 1) player:addSkillTries(skillId, nextTries - curTries + curTries / nextTries * voc:getRequiredSkillTries(skillId, curSkill + 2)) end else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não possui a quantidade necessária para comprar.") end return true end return true end buyComprar:separator(" ") buyComprar:register() Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. Bom pelo que vi na lib player.lua existe uma função function Player.addSkill(self, skillId, value, round) Eu apenas removi a linha 67 e 69 e modifiquei a linha 70. Ficando assim : Spoiler SKILL_CLUB = "skill_club" SKILL_DISTANCE = "skill_dist" SKILL_SHIELD = "skill_shielding" SKILL_MAGLEVEL = "maglevel" SKILL_SWORD = "skill_sword" SKILL_AXE = "skill_axe" local buyComprar = TalkAction("!comprar") local storage = 45611 local coinID = 9971 -- moeda para comprar skills 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 = 7}, ["skillclub"] = {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= 1, incre = 1, skill = 1}, ["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 = 2}, ["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 = 3}, ["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 = 4}, ["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 = 5}, ["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 = 7}, ["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 = 1}, ["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 = 2}, ["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 = 3}, ["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 = 4}, ["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 = 5}, } function buyComprar.onSay(player, words, param) local player = Player(player) local pid = player:getGuid() local tile = player:getTile() local param = param:lower() if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then player:sendCancelMessage("Você precisa estar em área protegida para utilizar este comando.") return true end 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 true end if param == "" then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nmontaria shadow draptor = montaria shadow draptor por 30 barras.\nmontaria golden lion = montaria golden lion por 30 barras.\nmontaria winter king = montaria winter king por 30 barras.\nmontaria flying divan = montaria flying divan por 30 barras.\nmontaria woodland prince = montaria woodland prince por 30 barras.\nmontaria black stag = montaria black stag por 30 barras.\nmontaria nether steed = montaria nether steed por 30 barras.\nmontaria snow pelt = montaria snow pelt por 30 barras.\nmontaria slagsnare = montaria slagsnare por 30 barras.\nmontaria sea devil = montaria sea devil por 55 barras.\nmontaria highland yak = montaria highland yak por 75 barras.\nmontaria copper fly = montaria copper fly por 60 barras.\nmontaria bloodcurl = montaria bloodcurl por 70 barras.\nmontaria poisonbane = montaria poisonbane por 65 barras.\nmontaria razorcreep = montaria razorcreep por 75 barras.\nmontaria noctungra = montaria noctungra por 70 barras.\nmontaria leafscuttler = montaria leafscuttler por 75 barras.\nmontaria jade pincer = montaria jade pincer por 60 barras.\nmontaria frostflare = montaria frostflare por 85 barras.\nroupa conjurer = roupa conjurer todos addons por 30 barras\nroupa ceremonial garb = roupa ceremonial garb todos addons por 30 barras.\nroupa puppeteer = roupa puppeteer todos addons por 30 barras.\nroupa death herald = roupa death herald todos addons por 30 barras.\nroupa winter warden = roupa winter warden todos addons por 30 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponível.") return true end if skills[param] then local v = skills[param] if param == "magiclevel" and player:getBaseMagicLevel() >= v.lim or (player:getBaseMagicLevel() + v.incre ) >= v.lim then player:sendCancelMessage(v.lim_msg) return true elseif player:getSkillLevel(v.skill) + v.incre >= v.lim then player:sendCancelMessage(v.lim_msg) return true end if not isInArray(v.vocations, player:getVocation():getId()) then player:sendCancelMessage(v.voc_msg) return true end if player:getItemCount(coinID) >= v.price then player:removeItem(coinID, v.price) player:setStorageValue(storage, os.time()+1) local skillId = v.skill local amount = v.incre for i = 1, amount do local curSkill = player:getSkillLevel(skillId) local curTries = player:getSkillTries(skillId) local voc = player:getVocation() local nextTries = voc:getRequiredSkillTries(skillId, curSkill + 1) player:addSkill(skillId, curSkill + 1) end else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não possui a quantidade necessária para comprar.") end return true end return true end buyComprar:separator(" ") buyComprar:register() Testa e me fala se funcionou!
Postado Maio 13, 2023 2 anos Autor 15 hours ago, Underewar said: Bom pelo que vi na lib player.lua existe uma função function Player.addSkill(self, skillId, value, round) Eu apenas removi a linha 67 e 69 e modifiquei a linha 70. Ficando assim : Reveal hidden contents SKILL_CLUB = "skill_club" SKILL_DISTANCE = "skill_dist" SKILL_SHIELD = "skill_shielding" SKILL_MAGLEVEL = "maglevel" SKILL_SWORD = "skill_sword" SKILL_AXE = "skill_axe" local buyComprar = TalkAction("!comprar") local storage = 45611 local coinID = 9971 -- moeda para comprar skills 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 = 7}, ["skillclub"] = {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= 1, incre = 1, skill = 1}, ["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 = 2}, ["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 = 3}, ["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 = 4}, ["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 = 5}, ["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 = 7}, ["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 = 1}, ["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 = 2}, ["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 = 3}, ["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 = 4}, ["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 = 5}, } function buyComprar.onSay(player, words, param) local player = Player(player) local pid = player:getGuid() local tile = player:getTile() local param = param:lower() if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then player:sendCancelMessage("Você precisa estar em área protegida para utilizar este comando.") return true end 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 true end if param == "" then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nmontaria shadow draptor = montaria shadow draptor por 30 barras.\nmontaria golden lion = montaria golden lion por 30 barras.\nmontaria winter king = montaria winter king por 30 barras.\nmontaria flying divan = montaria flying divan por 30 barras.\nmontaria woodland prince = montaria woodland prince por 30 barras.\nmontaria black stag = montaria black stag por 30 barras.\nmontaria nether steed = montaria nether steed por 30 barras.\nmontaria snow pelt = montaria snow pelt por 30 barras.\nmontaria slagsnare = montaria slagsnare por 30 barras.\nmontaria sea devil = montaria sea devil por 55 barras.\nmontaria highland yak = montaria highland yak por 75 barras.\nmontaria copper fly = montaria copper fly por 60 barras.\nmontaria bloodcurl = montaria bloodcurl por 70 barras.\nmontaria poisonbane = montaria poisonbane por 65 barras.\nmontaria razorcreep = montaria razorcreep por 75 barras.\nmontaria noctungra = montaria noctungra por 70 barras.\nmontaria leafscuttler = montaria leafscuttler por 75 barras.\nmontaria jade pincer = montaria jade pincer por 60 barras.\nmontaria frostflare = montaria frostflare por 85 barras.\nroupa conjurer = roupa conjurer todos addons por 30 barras\nroupa ceremonial garb = roupa ceremonial garb todos addons por 30 barras.\nroupa puppeteer = roupa puppeteer todos addons por 30 barras.\nroupa death herald = roupa death herald todos addons por 30 barras.\nroupa winter warden = roupa winter warden todos addons por 30 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponível.") return true end if skills[param] then local v = skills[param] if param == "magiclevel" and player:getBaseMagicLevel() >= v.lim or (player:getBaseMagicLevel() + v.incre ) >= v.lim then player:sendCancelMessage(v.lim_msg) return true elseif player:getSkillLevel(v.skill) + v.incre >= v.lim then player:sendCancelMessage(v.lim_msg) return true end if not isInArray(v.vocations, player:getVocation():getId()) then player:sendCancelMessage(v.voc_msg) return true end if player:getItemCount(coinID) >= v.price then player:removeItem(coinID, v.price) player:setStorageValue(storage, os.time()+1) local skillId = v.skill local amount = v.incre for i = 1, amount do local curSkill = player:getSkillLevel(skillId) local curTries = player:getSkillTries(skillId) local voc = player:getVocation() local nextTries = voc:getRequiredSkillTries(skillId, curSkill + 1) player:addSkill(skillId, curSkill + 1) end else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não possui a quantidade necessária para comprar.") end return true end return true end buyComprar:separator(" ") buyComprar:register() Testa e me fala se funcionou! Bom dia Undewar, desculpa pela demora to coma esposa no hospital, bom fiz o teste ele retornou esse erro no distro. ele remove o item id 9971 e logo em seguida retorna essa msg no distro
Postado Abril 12, 2024 1 ano O script anterior estava bugado e mal otimizado, faltando algumas funções. Então, fiz uma correção e agora está funcionando bem! De acordo com sua vocação, você pode comprar skills... Para quem deseja ultrapassar o limite de 350 skills, basta fazer algumas alterações no código-fonte para quebrar o limite e poder ter 350+ habilidades, entende? Espero ter ajudado. testado e funcional ok!! -- 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 player:addMagicLevel(skillData.incre) print("Player: " .. player:getName() .. " adquiriu " .. skillData.incre .. " níveis de magic level. Novo magic level: " .. newMagLevel) else player:addSkill(skillId, skillData.incre) 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()
Postado Abril 22, 2024 1 ano Em 12/04/2024 em 18:56, Mateus Robeerto disse: O script anterior estava bugado e mal otimizado, faltando algumas funções. Então, fiz uma correção e agora está funcionando bem! De acordo com sua vocação, você pode comprar skills... Para quem deseja ultrapassar o limite de 350 skills, basta fazer algumas alterações no código-fonte para quebrar o limite e poder ter 350+ habilidades, entende? Espero ter ajudado. testado e funcional ok!! -- 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 player:addMagicLevel(skillData.incre) print("Player: " .. player:getName() .. " adquiriu " .. skillData.incre .. " níveis de magic level. Novo magic level: " .. newMagLevel) else player:addSkill(skillId, skillData.incre) 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() 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()
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.