Postado Junho 29, 2016 8 anos desculpe reviver o topico, mas gostaria de saber se é possivel colocar para uma classe especifica pode ultilizar... obrigado xD
Postado Junho 29, 2016 8 anos Autor Em 29/06/2016 em 00:38, elipe disse: desculpe reviver o topico, mas gostaria de saber se é possivel colocar para uma classe especifica pode ultilizar... obrigado xD claro, abaixo de function onUse(cid, item, fromPosition, itemEx, toPosition) coloque if getPlayerVocation(cid) ~= X then return false end Se a classe for diferente de X (insira o numero da classe aqui) então cancele.
Postado Junho 29, 2016 8 anos wolf tenho uma dúvida com a parte de actions desse seu script de mining: terra = {9021,9022,9023,9024,9025} levels = { [-1] = 2229, ---- skull [0] = 1294, --- small stone [1] = 3976, --- worm [10] = 2149, -- Small Emerald [12] = 2146, -- Small Sapphire [15] = 2145, -- Small Diamond [17] = 2150, -- Small Amethyst [20] = 2147, -- Small Ruby [25] = 2144, -- Black Pearls [27] = 2143, -- White Pearls [40] = 7761, -- small enchanted emerald [42] = 7759, -- Small Enchanted Sapphiire [45] = 7762, -- Small Enchanted Amethyst [50] = 7760, -- Small Enchanted Ruby [80] = 2157, -- Gold Nuggets [100] = 2177, 2157, 2156, 2158, 2155, 2153, 2154 -- Life Crystal, red gem, blue gem, green gem, violet gem, yellow gem } local config = { storage = 19333, chance = 15, --- chance de achar um item ou não k = 1, --- 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) ..".") 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, 3) else doSendMagicEffect(toPosition, 2) 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 a tabela no inicio onde vc configura os níveis de mining, pelo que eu entendi de acordo com cada skill somente a partir do mesmo os itens que estão configurados viriam. no meu server usando como exemplo as gems são de extrema utilidade, e esta configurado para somente no skill de mining 100 poder consegui-las correto? essa seria a lógica certo? estou estranhando uma coisa digamos que meu skill de mining seja 28, mesmo assim eu estou conseguindo as gems sendo que só seria possível com skill 100, não ha erros nada do tipo distro,console, etc.., somente esta situação, poderia dizer como fixar pra ficar cravado que somente no skill correspondente da tabela ter a chance de achar o item pois não só com as gem mas em todos itens configurados com seus respectivos skills não importa em qual nível eu ja esteja com o mining todos podem aparecer. desculpe se eu acabei enrolando com muita informação. Editado Junho 29, 2016 8 anos por rheynkhen (veja o histórico de edições)
Postado Junho 29, 2016 8 anos Autor 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 a tabela de drops inicialmente tá vazia, aí eu vou de -1 até o valor do storage configurado pra ser o level; se existir levels ele insere o item na tabela de drops. Por fim ele pega aleatoriamente um dos itens da tabela de drops. Oque tá acontecendo no seu script é q vc cometeu um erro bem simples, vc colocou [100] = 2177, 2157, 2156, 2158, 2155, 2153, 2154 a tabela entende isso da seguinte maneira [100] = 2177, [2] = 2157, [3] = 2156.. e por aí vai. Se você quiser usar desse jeito q vc fez, vc tem que botar um { no 100, ficando assim a linha inteira> [100] = {2177, 2157, 2156, 2158, 2155, 2153, 2154} -- Life Crystal, red gem, blue gem, green gem, violet gem, yellow gem assim vc denota que todos esses elementos pertencem ao 100, só que aí vc teria que modificar pra em vez dele verificar somente o levels ele verifica se caso o levels for uma tabela, então adicionar todos os elementos dela. if type(levels) == 'table' then for _, v in ipairs (levels) do table.insert(drops, v) else table.insert(drops, levels) end end Outra solução seria deixar no mesmo modelo do script original, ou seja, em vez de atribuir todos esses pro 100, vc poderia atribuir pra niveis intermédiarios: [98] = 2157 [99] = 2156...
Postado Junho 29, 2016 8 anos terra = {6573} levels = { [-1] = 2229, ---- skull [0] = 1294, --- small stone [1] = 3976, --- worm [10] = 2149, -- Small Emerald [12] = 2146, -- Small Sapphire [15] = 2145, -- Small Diamond [17] = 2150, -- Small Amethyst [20] = 2147, -- Small Ruby [25] = 2144, -- Black Pearls [27] = 2143, -- White Pearls [30] = 2157, -- Gold Nuggets [35] = 2156, --- red gem [36] = 2158, -- blue gem [37] = 2155, -- green gem [38] = 2153, -- violet gem [39] = 2154, -- yellow gem [40] = 7761, -- small enchanted emerald [42] = 7759, -- Small Enchanted Sapphiire [45] = 7762, -- Small Enchanted Amethyst [50] = 7760, -- Small Enchanted Ruby [70] = 2177 -- Life Crystal } local config = { storage = 19333, chance = 40, --- chance de achar um item ou não k = 1, --- 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) ..".") 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, 3) else doSendMagicEffect(toPosition, 2) 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 tentei de 2 maneiras usar o script, usando como action e uniqID no caso no piso e não deu certo falta alterar algo no script? pra não dar erro de duplicação você poderia deixar como action tudo bem? irei usar varios crystais para minerar será em 1 servidor RPG
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.