Postado Junho 1, 2017 7 anos Alguém pode me dar uma força? estou utilizando o script de mining do nosso querido xWhiteWolf e o Perfect Upgrade System 2.0. O problema é que quando o mining system está ativo (action) eu não consigo refinar nenhum item, aparece o seguinte erro na distro: Vou deixar os 2 scripts em spoiler: MINING SYSTEM Spoiler terra = {4471,4475,4485,1304,4473,4478,3339,4474,4508,4472,4476} levels = { [-1] = 2229, ---- skull [0] = 1294, --- small stone [10] = 2149, -- Small Emerald [12] = 2146, -- Small Sapphire [20] = 2145, -- Small Diamond [40] = 2150, -- Small Amethyst [60] = 2147, -- Small Ruby [80] = 2144, -- Black Pearls [100] = 2143, -- White Pearls [120] = 7761, -- small enchanted emerald [140] = 7759, -- Small Enchanted Sapphiire [160] = 7762, -- Small Enchanted Amethyst [180] = 7760, -- Small Enchanted Ruby [200] = 2157 -- Pepita de Ouro } local config = { storage = 19333, chance = 2, --- chance de achar um item ou não k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante) experience = 19334 } function onUse(cid, item, fromPosition, itemEx, toPosition) local drops = {} function getDrops(cid) for i= -1,getPlayerStorageValue(cid, config.storage) do if levels[i] then table.insert(drops, levels[i]) end end return true end if isInArray(terra, itemEx.itemid) then getDrops(cid) doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1) local experience = getPlayerStorageValue(cid, config.experience) if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1) doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".") doSendMagicEffect(getCreaturePosition(cid),98) doSendAnimatedText(getCreaturePosition(cid), 'Mining UP', 100, cid) if getPlayerStorageValue(cid, config.storage) == 50 then doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.") doPlayerAddItem(cid, 7497, 1, true) end end if config.chance >= math.random(1,100) then if #drops >= 1 then local item = drops[math.random(1,#drops)] doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".") doPlayerAddItem(cid, item, 1, true) end doSendMagicEffect(toPosition, 289) doSendAnimatedText(toPosition , 'TiickK!', 169) else doSendMagicEffect(toPosition, 288) doSendAnimatedText(toPosition , "Puuff!", 61) return true end elseif itemEx.itemid == item.itemid then doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".") else return false end return true end UPGRADE SYSTEM Spoiler --[[ PERFECT UPGRADE SYSTEM 2.0 Criado por Oneshot É proibido a venda ou a cópia sem os devidos créditos desse script. ]]-- UpgradeHandler = { levels = { [1] = {70, false, false}, [2] = {50, false, false}, [3] = {30, false, false}, [4] = {20, false, false}, [5] = {10, false, false}, [6] = {5, false, false}, [7] = {4, false, false}, [8] = {3, false, false}, [9] = {2, false, false}, [10] = {1, false, false} }, broadcast = 10, attributes = { ["attack"] = 2, ["defense"] = 100, ["armor"] = 100 }, message = { console = "Tentando refinar %s para o nivel +%s com %s%% de chance de sucesso.", success = "Voce deu upgrade em %s para o nivel +%s", fail = "Voce falhou ao tentar da upgrade em %s para o nivel +%s", downgrade = "The upgrade level of %s has downgraded to +%s", erase = "The upgrade level of %s has been erased.", maxlevel = "A %s ja esta no nivel maximo.", notupgradeable = "Este item nao da pra dar upgrade.", broadcast = "O jogador %s teve sucesso em dar upgrade no %s ao nivel +%s.\nParabens!!", invalidtool = "Essa nao e uma ferramenta valida de upgrade.", toolrange = "Essa ferramenta so pode ser usada para dar upgrade do nivel +%s ao +%s" }, tools = { [2153] = {range = {0, 10}, info = {chance = 0, removeable = false}}, [2154] = {range = {0, 10}, info = {chance = 100, removeable = false}} }, isEquipment = function(self) local weaponType = self:getItemWeaponType() return ((weaponType > 0 and weaponType < 7) or self.item.armor ~= 0) end, setItemName = function(self, name) return doItemSetAttribute(self.item.uid, "name", name) end, chance = function(self) local chances = {} chances.upgrade = (self.levels[self.item.level + 1][1] or 100) chances.downgrade = (self.item.level * 5) chances.erase = (self.item.level * 3) return chances end } function UpgradeHandler:new(item) local obj, ret = {} obj.item = {} obj.item.level = 0 obj.item.uid = item.uid for key, value in pairs(getItemInfo(item.itemid)) do obj.item[key] = value end ret = setmetatable(obj, {__index = function(self, index) if _G[index] then return (setmetatable({callback = _G[index]}, {__call = function(self, ...) return self.callback(item.uid, ...) end})) else return UpgradeHandler[index] end end}) if ret:isEquipment() then ret:update() return ret end return false end function UpgradeHandler:update() self.item.level = (tonumber(self:getItemName():match("%+(%d+)")) or 0) end function UpgradeHandler:refine(uid, item) if not self.item then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE, self.message.notupgradeable) return "miss" end local tool = self.tools[item.itemid] if(tool == nil) then doPlayerSendTextMessage(uid, MESSAGE_EVENT_DEFAULT, self.message.invalidtool) return "miss" end if(self.item.level > #self.levels) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.maxlevel:format(self.item.name)) return "miss" end if(self.item.level < tool.range[1] or self.item.level >= tool.range[2]) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.toolrange:format(unpack(tool.range))) return "miss" end local chance = (self:chance().upgrade + tool.info.chance) doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE, self.message.console:format(self.item.name, (self.item.level + 1), math.min(100, chance))) if(tool.info.removeable == false) then doRemoveItem(item.uid, 1) end if chance * 100 > math.random(1, 10000) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_ORANGE, self.message.success:format(self.item.name, (self.item.level + 1))) if (self.item.level + 1) >= self.broadcast then doBroadcastMessage(self.message.broadcast:format(getCreatureName(uid), self.item.name, (self.item.level + 1))) end self:setItemName((self.item.level > 0 and self:getItemName():gsub("%+(%d+)", "+".. (self.item.level + 1)) or (self:getItemName() .." +1"))) for key, value in pairs(self.attributes) do if getItemAttribute(self.item.uid, key) ~= nil or self.item[key] ~= 0 then doItemSetAttribute(self.item.uid, key, (self.item.level > 0 and getItemAttribute(self.item.uid, key) or self.item[key]) + value) end end return "success" else if(self.levels[self.item.level][3] == true and (self:chance().erase * 100) > math.random(1, 10000)) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.erase:format(self.item.name)) self:setItemName(self.item.name) for key, value in pairs(self.attributes) do if self.item[key] > 0 then doItemSetAttribute(self.item.uid, key, self.item[key]) end end elseif(self.levels[self.item.level][2] == true and (self:chance().downgrade * 100) > math.random(1, 10000)) then doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.downgrade:format(self.item.name, (self.item.level - 1))) self:setItemName((self.item.level == 1 and self.item.name or self:getItemName():gsub("%+(%d+)", "+".. (self.item.level - 1)))) for key, value in pairs(self.attributes) do if getItemAttribute(self.item.uid, key) ~= nil or self.item[key] ~= 0 then doItemSetAttribute(self.item.uid, key, (self.item[key] + value * (self.item.level - 1))) end end else doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_RED, self.message.fail:format(self.item.name, (self.item.level + 1))) end return "fail" end end Grato desde já por qual quer tipo de ajuda!
Postado Junho 1, 2017 7 anos tenta a script do MINING desta forma pra ver Spoiler terra = {4471,4475,4485,1304,4473,4478,3339,4474,4508,4472,4476} terraa = { [-1] = 2229, ---- skull [0] = 1294, --- small stone [10] = 2149, -- Small Emerald [12] = 2146, -- Small Sapphire [20] = 2145, -- Small Diamond [40] = 2150, -- Small Amethyst [60] = 2147, -- Small Ruby [80] = 2144, -- Black Pearls [100] = 2143, -- White Pearls [120] = 7761, -- small enchanted emerald [140] = 7759, -- Small Enchanted Sapphiire [160] = 7762, -- Small Enchanted Amethyst [180] = 7760, -- Small Enchanted Ruby [200] = 2157 -- Pepita de Ouro } local config = { storage = 19333, chance = 2, --- chance de achar um item ou não k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante) experience = 19334 } function onUse(cid, item, fromPosition, itemEx, toPosition) local drops = {} function getDrops(cid) for i= -1,getPlayerStorageValue(cid, config.storage) do if terraa then table.insert(drops, terraa) end end return true end if isInArray(terra, itemEx.itemid) then getDrops(cid) doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1) local experience = getPlayerStorageValue(cid, config.experience) if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1) doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".") doSendMagicEffect(getCreaturePosition(cid),98) doSendAnimatedText(getCreaturePosition(cid), 'Mining UP', 100, cid) if getPlayerStorageValue(cid, config.storage) == 50 then doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.") doPlayerAddItem(cid, 7497, 1, true) end end if config.chance >= math.random(1,100) then if #drops >= 1 then local item = drops[math.random(1,#drops)] doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".") doPlayerAddItem(cid, item, 1, true) end doSendMagicEffect(toPosition, 289) doSendAnimatedText(toPosition , 'TiickK!', 169) else doSendMagicEffect(toPosition, 288) doSendAnimatedText(toPosition , "Puuff!", 61) return true end elseif itemEx.itemid == item.itemid then doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".") else return false end return true end Editado Junho 1, 2017 7 anos por Radamanthys Wov Script errada (veja o histórico de edições)
Postado Junho 1, 2017 7 anos Autor 26 minutos atrás, Radamanthys Wov disse: tenta a script do MINING desta forma pra ver Ocultar conteúdo terra = {4471,4475,4485,1304,4473,4478,3339,4474,4508,4472,4476} terraa = { [-1] = 2229, ---- skull [0] = 1294, --- small stone [10] = 2149, -- Small Emerald [12] = 2146, -- Small Sapphire [20] = 2145, -- Small Diamond [40] = 2150, -- Small Amethyst [60] = 2147, -- Small Ruby [80] = 2144, -- Black Pearls [100] = 2143, -- White Pearls [120] = 7761, -- small enchanted emerald [140] = 7759, -- Small Enchanted Sapphiire [160] = 7762, -- Small Enchanted Amethyst [180] = 7760, -- Small Enchanted Ruby [200] = 2157 -- Pepita de Ouro } local config = { storage = 19333, chance = 2, --- chance de achar um item ou não k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante) experience = 19334 } function onUse(cid, item, fromPosition, itemEx, toPosition) local drops = {} function getDrops(cid) for i= -1,getPlayerStorageValue(cid, config.storage) do if terraa thentable.insert(drops, terraa)endendreturn trueend if isInArray(terra, itemEx.itemid) thengetDrops(cid)doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)local experience = getPlayerStorageValue(cid, config.experience)if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k thendoPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")doSendMagicEffect(getCreaturePosition(cid),98)doSendAnimatedText(getCreaturePosition(cid), 'Mining UP', 100, cid)if getPlayerStorageValue(cid, config.storage) == 50 thendoPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.")doPlayerAddItem(cid, 7497, 1, true)endendif config.chance >= math.random(1,100) thenif #drops >= 1 thenlocal item = drops[math.random(1,#drops)]doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".")doPlayerAddItem(cid, item, 1, true)enddoSendMagicEffect(toPosition, 289)doSendAnimatedText(toPosition , 'TiickK!', 169)elsedoSendMagicEffect(toPosition, 288)doSendAnimatedText(toPosition , "Puuff!", 61)return trueendelseif itemEx.itemid == item.itemid thendoPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".")elsereturn falseendreturn trueend Funcionou! muito obrigado O problema era que os 2 scripts tinha levels = { ?
Postado Junho 1, 2017 7 anos O problema era que estava criando duas funções, dai estavam entrando em comflito ^^, Se poder me dar um rep fico feliz! Se tiver ajudado e claro
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.