Postado Novembro 23, 2021 3 anos Olá pessoal bom dia, Gostaria de pedir uma ajuda a vocês, Estou com script de gemas, funciona perfeito... Porem o meu servidor possui vocações epics, no caso [9,10,11,12] então quando o player está nestas vocação epics ele não consegui mais pegar a gems e fala a frase "Você precisa estar promovido para usar a gema" Então gostaria de modificar o script para aceitar essas novas vocações epics. Segue o lib Spoiler gems = { id = {8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012}, interval = {800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800} } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."}, colorElderDruid = {180,180}, colorMasterSorcerer = {30,215}, colorRoyalPaladin = {251,10}, colorEliteKnight = {204,212}, colorHighSaintess = {180,180}, colorHellWizard = {30,215}, colorForceArcher = {251,10}, colorTitanBlader = {204,212} } function doRemoveGemEffect(cid) local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 1 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if getPlayerStorageValue(cid, gems.storage[voc]) == -1 then else setPlayerStorageValue(cid, gems.storage[voc], 0) end end function doUseGem(cid, item) local level = getPlayerLevel(cid) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] if getPlayerPromotionLevel(cid) > 1 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return false end setPlayerStorageValue(cid, gems.storage[voc], 1) sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) return true end function sendGemEffect(cid, storage, interval) if isPlayer(cid) then local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local level = getPlayerLevel(cid) local color = 1 if level > 349 then if getPlayerPromotionLevel(cid) > 1 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if voc == 1 then color = gemMsg.colorElderDruid[math.random(1,#gemMsg.colorHighSaintess)] elseif voc == 2 then color = gemMsg.colorMasterSorcerer[math.random(1,#gemMsg.colorHellWizard)] elseif voc == 3 then color = gemMsg.colorRoyalPaladin[math.random(1,#gemMsg.colorForceArcher)] elseif voc == 4 then color = gemMsg.colorEliteKnight[math.random(1,#gemMsg.colorTitanBlader)] end doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if getPlayerStorageValue(cid, gems.storage[voc]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end else stopEvent(sendGemEffect(cid, storage, interval)) end end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage[i], 0) end return true end function isGemActivated(cid) local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 1 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return true end return false end return true end Segue a Action Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 1 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end gem = gems.id[voc] if item.itemid == gem then if getPlayerLevel(cid) < 350 then doCreatureSay(cid,"É necessário level 350 ou maior para absorver uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) else if getPlayerPromotionLevel(cid) > 0 then if getPlayerStorageValue(cid,21202) == -1 then setPlayerStorageValue(cid,21202,1) doUseGem(cid, item) doCreatureSay(cid,"Você absorveu uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(cid),65) else doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) end else doCreatureSay(cid,"Você precisa estar promovido para usar a gema!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) end end else doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return false end return true end Agradeço desde já muito obrigado.
Postado Novembro 25, 2021 3 anos vc já fez alguma alteração no código? [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Novembro 26, 2021 3 anos Autor 6 horas atrás, Vodkart disse: vc já fez alguma alteração no código? Sim, alterei o lvl para usar. E já alterei o nomes das colorVocation para o do servidor. No caso estava a primeira promotion... Agora, DigoleraZica disse: Sim, alterei o lvl para usar. E já alterei o nomes das colorVocation para o do servidor. No caso estava a primeira promotion... Abaixo está a lib original sem as minhas alterações Spoiler gems = { id = {8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012}, interval = {600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600} } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."}, colorDruid = {180,180}, colorSorcerer = {30,215}, colorPaladin = {251,10}, colorKnight = {204,212}, colorElderDruid = {180,180}, colorMasterSorcerer = {30,215}, colorRoyalPaladin = {251,10}, colorEliteKnight = {204,212} } function doRemoveGemEffect(cid) local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if getPlayerStorageValue(cid, gems.storage[voc]) == -1 then else setPlayerStorageValue(cid, gems.storage[voc], 0) end end function doUseGem(cid, item) local level = getPlayerLevel(cid) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return false end setPlayerStorageValue(cid, gems.storage[voc], 1) sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) doRemoveItem(item.uid, 1) return true end function sendGemEffect(cid, storage, interval) if isPlayer(cid) then local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local level = getPlayerLevel(cid) local color = 1 if level > 199 then if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if voc == 1 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 2 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 3 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 4 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if getPlayerStorageValue(cid, gems.storage[voc]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end else stopEvent(sendGemEffect(cid, storage, interval)) end end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage[i], 0) end return true end function isGemActivated(cid) local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return true end return false end return true end
Postado Novembro 26, 2021 3 anos gems = { id = {8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012}, interval = {800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800} } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."}, class_color = { [1] = {180,180}, [2] = {30,215}, [3] = {251,10}, [4] = {204,212}, [5] = {180,180}, [6] = {30,215}, [7] = {251,10}, [8] = {204,212}, [9] = {180,180}, [10] = {30,215}, [11] = {251,10}, [12] = {204,212} } } function doRemoveGemEffect(cid) local voc = getPlayerVocation(cid) setPlayerStorageValue(cid, gems.storage[voc], 0) end function doUseGem(cid, item) local level = getPlayerLevel(cid) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return false end setPlayerStorageValue(cid, gems.storage[voc], 1) sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) doRemoveItem(item.uid, 1) return true end function sendGemEffect(cid, storage, interval) if not isCreature(cid) then return LUA_ERROR end local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 local var = gemMsg.class_color[voc] if getPlayerLevel(cid) < 200 or not var then return true -- ja para o effect end local color = var[math.random(1,#var)] doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if isGemActivated(cid) then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage[i], 0) end return true end function isGemActivated(cid) local voc = getPlayerVocation(cid) return getPlayerStorageValue(cid, gems.storage[voc]) > 0 and true or false end [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.