Ir para conteúdo
  • Cadastre-se

(Resolvido)[AJUDA] Aceitar outra vocação


Ir para solução Resolvido por Vodkart,

Posts Recomendados

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.

Link para o post
Compartilhar em outros sites
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

 

 

Link para o post
Compartilhar em outros sites
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

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
19 minutos atrás, Vodkart disse:

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

 

Aconteceu 2 coisas,

 

O efeito da gema só funciona quando eu relogo o personagem gostaria de quando já desse use no crystal já começaria a sair o efeito...

Há já ia me esquecendo o sistema possui uma checagem em login.lua

Spoiler

-- Gema System
	if getPlayerStorageValue(cid, 21202) > 0 then
            local voc = getPlayerVocation(cid)
            if getPlayerPromotionLevel(cid) > 0 then
              voc = voc - (getPlayerPromotionLevel(cid) * 4)
            end
            if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then
                  sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
            end   
      end  

 

 

Outra erro é que quando dou use com a vocação novas (9,10,11,12) retorna a mensagem da actions

Você precisa estar promovido para usar a gema!

Já para as outras vocações está funcionando...

Acredito que seja na parte da action do scripts... 

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 

 

 

 

 

Link para o post
Compartilhar em outros sites

Exato, como eu alterei a lib eu teria que alterar os demais códigos... enfim...

 

LIB

 

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 voc = getPlayerVocation(cid)
	local interval = gems.interval[voc]
	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 or not isGemActivated(cid) 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

 

 

LOGIN

-- Gema System
if getPlayerStorageValue(cid, 21202) > 0 then
	local voc = getPlayerVocation(cid)
	if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then
		sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
	end 
end

 

ACTION

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end
	local voc = getPlayerVocation(cid)
	local 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)
			return true
		elseif getPlayerStorageValue(cid,21202) > 0 then
			doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1)
			doSendMagicEffect(getThingPos(cid), 2)
			return true
		end
		setPlayerStorageValue(cid, 21202,1)
		setPlayerStorageValue(cid, gems.storage[voc], 1)
		doUseGem(cid, item)
		doCreatureSay(cid,"Você absorveu uma gema espiritual!",TALKTYPE_ORANGE_1)
		doSendMagicEffect(getPlayerPosition(cid),65)
		return true
	else
		doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)	
		return true
	end
	return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
43 minutos atrás, Vodkart disse:

Exato, como eu alterei a lib eu teria que alterar os demais códigos... enfim...

 

LIB

 


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 voc = getPlayerVocation(cid)
	local interval = gems.interval[voc]
	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 or not isGemActivated(cid) 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

 

 

LOGIN


-- Gema System
if getPlayerStorageValue(cid, 21202) > 0 then
	local voc = getPlayerVocation(cid)
	if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then
		sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
	end 
end

 

ACTION

 


function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end
	local voc = getPlayerVocation(cid)
	local 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)
			return true
		elseif getPlayerStorageValue(cid,21202) > 0 then
			doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1)
			doSendMagicEffect(getThingPos(cid), 2)
			return true
		end
		setPlayerStorageValue(cid, 21202,1)
		setPlayerStorageValue(cid, gems.storage[voc], 1)
		doUseGem(cid, item)
		doCreatureSay(cid,"Você absorveu uma gema espiritual!",TALKTYPE_ORANGE_1)
		doSendMagicEffect(getPlayerPosition(cid),65)
		return true
	else
		doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)	
		return true
	end
	return true
end

 

Funcionou perfeito, muito obrigado!

 

Só mais uma alteração que gostaria

 

Quando o player usar o crystal da sua vocação falaria o nome da magia da vocação dele.

Segue abaixo.

magias = {
        [1] = {zesshou hachimon},
        [2] = {jukai kousan},
        [3] = {mugen shiki},
        [4] = {yahumuki},
        [5] = {zesshou hachimon},
        [6] = {jukai kousan},
        [7] = {mugen shiki},
        [8] = {yahumuki},
        [9] = {zesshou hachimon},
        [10] = {jukai kousan},
        [11] = {mugen shiki},
        [12] = {yahumuki}
    }

Exemplo 

Você absorveu uma gema espiritual (zesshou hachimon)!

 

Teria como fazer essa alteração, valeuu

 

Link para o post
Compartilhar em outros sites
  • Solução
local magias = {
	[1] = "zesshou hachimon",
	[2] = "jukai kousan",
	[3] = "mugen shiki",
	[4] = "yahumuki",
	[5] = "zesshou hachimon",
	[6] = "jukai kousan",
	[7] = "mugen shiki",
	[8] = "yahumuki",
	[9] = "zesshou hachimon",
	[10] = "jukai kousan",
	[11] = "mugen shiki",
	[12] = "yahumuki"
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end
	local voc = getPlayerVocation(cid)
	local 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)
			return true
		elseif getPlayerStorageValue(cid,21202) > 0 then
			doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1)
			doSendMagicEffect(getThingPos(cid), 2)
			return true
		end
		setPlayerStorageValue(cid, 21202,1)
		setPlayerStorageValue(cid, gems.storage[voc], 1)
		doUseGem(cid, item)
		doCreatureSay(cid,"Você absorveu uma gema espiritual ("..magias[voc]..")!",TALKTYPE_ORANGE_1)
		doSendMagicEffect(getPlayerPosition(cid),65)
		return true
	else
		doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)	
		return true
	end
	return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo