[Encerrado] Erro ao usar PokeDex em si mesmo

iRyu
Por iRyu
em Tópicos Sem Resposta

iRyu

</3
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 24/08/11Posts: 51Gênero: Masculino

Salve galera, recentemente achei um servidor perdido na net e estou dando uma fuçada nele porem estou com um erro que quando uso a Pokedex em mim me retorna este erro:

[Error - Action Interface]
data/actions/scripts/pokedex.lua:onUse
Description:
data/actions/scripts/pokedex.lua:36: attempt to index field '?' (a number value)
stack traceback:
        data/actions/scripts/pokedex.lua:36: in function <data/actions/scripts/pokedex.lua:3>

 

O script da Pokedex:

local rate = 20

function onUse(cid, item, fromPos, item2, toPos)
 
if not isCreature(item2.uid) then
return true
end

local poke = getCreatureName(item2.uid)

	if isMonster(item2.uid) then
       local this = newpokedex[getCreatureName(item2.uid)]
	   local myball = 0
	   if isSummon(item2.uid) then
	      myball = getPlayerSlotItem(getCreatureMaster(item2.uid), 8)
       end
       if not getPlayerInfoAboutPokemon(cid, poke).dex then
	      local exp = this.level * rate
          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked "..getCreatureName(item2.uid).." in your pokedex!")
	      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained "..exp.." experience points.")
          doSendMagicEffect(getThingPos(cid), 210)
          doPlayerAddExperience(cid, exp)
          doAddPokemonInDexList(cid, poke)
       else
          doShowPokedexRegistration(cid, item2, myball)
       end
	return true
	end

if not isPlayer(item2.uid) then return true end

	local kanto = 0
	local johto = 0
                                    --alterado v1.7 \/\/
	for i = 1, #oldpokedex do
		if getPlayerInfoAboutPokemon(item2.uid, oldpokedex[i][1]).dex then
		   if i <= 151 then
              kanto = kanto+1
           elseif i >= 209 then
              johto = johto+1
           end
		end
	end                                                      --alterado v1.6

	local player = getRecorderPlayer(toPos, cid)

	if cid == player then
	    doPlayerSendTextMessage(cid, 27, "You has unlocked "..kanto.." kanto's and "..johto.." johto's pokémons until now.") 
        doPlayerSetVocation(cid, 9) --alterado v1.6
        openChannelDialog(cid)
	end

return true
end

 

Se alguém puder me ajudar ❤️

“As maiores loucuras são as mais sensatas alegrias, pois tudo que fizermos hoje ficará na memória daqueles que um dia sonharão em ser como nós: Loucos, porém, felizes.”

 

Crypter

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 24/02/17Posts: 368Gênero: Masculino
local rate = 20

function onUse(cid, item, fromPos, item2, toPos)
 
if not isCreature(item2.uid) then
return true
end

local poke = getCreatureName(item2.uid)

	if isMonster(item2.uid) then
       local this = newpokedex[getCreatureName(item2.uid)]
	   local myball = 0
	   if isSummon(item2.uid) then
	      myball = getPlayerSlotItem(getCreatureMaster(item2.uid), 8)
       end
       if not getPlayerInfoAboutPokemon(cid, poke).dex then
	      local exp = this.level * rate
          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked "..getCreatureName(item2.uid).." in your pokedex!")
	      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained "..exp.." experience points.")
          doSendMagicEffect(getThingPos(cid), 210)
          doPlayerAddExperience(cid, exp)
          doAddPokemonInDexList(cid, poke)
       else
          doShowPokedexRegistration(cid, item2, myball)
       end
	return true
	end

if not isPlayer(item2.uid) then return true end

	local kanto = 0
	local johto = 0
                                   --alterado v1.7 \/\/
	if (not oldpokedex or #oldpokedex <=0) then return end
	for i = 1, #oldpokedex do
		if getPlayerInfoAboutPokemon(item2.uid, oldpokedex[i][1]).dex then
		   if i <= 151 then
              kanto = kanto+1
           elseif i >= 209 then
              johto = johto+1
           end
		end
	end                                                      --alterado v1.6

	local player = getRecorderPlayer(toPos, cid)

	if cid == player then
	    doPlayerSendTextMessage(cid, 27, "You has unlocked "..kanto.." kanto's and "..johto.." johto's pokémons until now.") 
        doPlayerSetVocation(cid, 9) --alterado v1.6
        openChannelDialog(cid)
	end

return true
end

 

iRyu

</3
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 24/08/11Posts: 51Gênero: Masculino
Em 27/06/2018 em 11:18, Crypter disse:
local rate = 20

function onUse(cid, item, fromPos, item2, toPos)
 
if not isCreature(item2.uid) then
return true
end

local poke = getCreatureName(item2.uid)

	if isMonster(item2.uid) then
       local this = newpokedex[getCreatureName(item2.uid)]
	   local myball = 0
	   if isSummon(item2.uid) then
	      myball = getPlayerSlotItem(getCreatureMaster(item2.uid), 8)
       end
       if not getPlayerInfoAboutPokemon(cid, poke).dex then
	      local exp = this.level * rate
          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked "..getCreatureName(item2.uid).." in your pokedex!")
	      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained "..exp.." experience points.")
          doSendMagicEffect(getThingPos(cid), 210)
          doPlayerAddExperience(cid, exp)
          doAddPokemonInDexList(cid, poke)
       else
          doShowPokedexRegistration(cid, item2, myball)
       end
	return true
	end

if not isPlayer(item2.uid) then return true end

	local kanto = 0
	local johto = 0
                                   --alterado v1.7 \/\/
	if (not oldpokedex or #oldpokedex <=0) then return end
	for i = 1, #oldpokedex do
		if getPlayerInfoAboutPokemon(item2.uid, oldpokedex[i][1]).dex then
		   if i <= 151 then
              kanto = kanto+1
           elseif i >= 209 then
              johto = johto+1
           end
		end
	end                                                      --alterado v1.6

	local player = getRecorderPlayer(toPos, cid)

	if cid == player then
	    doPlayerSendTextMessage(cid, 27, "You has unlocked "..kanto.." kanto's and "..johto.." johto's pokémons until now.") 
        doPlayerSetVocation(cid, 9) --alterado v1.6
        openChannelDialog(cid)
	end

return true
end

 

Continua o mesmo erro, eu retirei esta parte do script para ver se funcionava:

	if (not oldpokedex or #oldpokedex <=0) then return end
	for i = 1, #oldpokedex do
		if getPlayerInfoAboutPokemon(item2.uid, oldpokedex[i][1]).dex then
		   if i <= 151 then
              kanto = kanto+1
           elseif i >= 209 then
              johto = johto+1
           end
		end
	end  

E funciona normalmente, porem sem a contagem de quantos pokemons tem na dex..

“As maiores loucuras são as mais sensatas alegrias, pois tudo que fizermos hoje ficará na memória daqueles que um dia sonharão em ser como nós: Loucos, porém, felizes.”

 

Gabrieltxu

O Héroi
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 12/06/12Posts: 2180Gênero: MasculinoChar no Tibia: Supreme Player

da uma visada 1° se tem a tabela oldpokedex ta certinha no seu lib/configuration.lua 

e testa esse aqui: 



local rate = 20

function onUse(cid, item, fromPos, item2, toPos)
 
if not isCreature(item2.uid) then
return true
end

local poke = getCreatureName(item2.uid)

    if isMonster(item2.uid) then
       local this = newpokedex[getCreatureName(item2.uid)]
       local myball = 0
       if isSummon(item2.uid) then
          myball = getPlayerSlotItem(getCreatureMaster(item2.uid), ?
       end
       if not getPlayerInfoAboutPokemon(cid, poke).dex then
          local exp = this.level * rate
          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked "..getCreatureName(item2.uid).." in your pokedex!")
          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained "..exp.." experience points.")
          doSendMagicEffect(getThingPos(cid), 210)
          doPlayerAddExperience(cid, exp)
          doAddPokemonInDexList(cid, poke)
       else
          doShowPokedexRegistration(cid, item2, myball)
       end
    return true
    end

if not isPlayer(item2.uid) then return true end

    local kanto = 0
    local johto = 0
                                   --alterado v1.7 \/\/
    for i = 1, #oldpokedex do
        if getPlayerInfoAboutPokemon(item2.uid, oldpokedex[1]).dex then
           if i <= 151 then
              kanto = kanto+1
           elseif i >= 209 then
              johto = johto+1
           end
        end
    end                                                      --alterado v1.6

    local player = getRecorderPlayer(toPos, cid)

    if cid == player then
        doPlayerSendTextMessage(cid, 27, "You has unlocked "..kanto.." kanto's and "..johto.." johto's pokémons until now.") 
        doPlayerSetVocation(cid, 9) --alterado v1.6
        openChannelDialog(cid)
    end

return true
end

 

Canal do facebook de lives!! cola la galera me ajudar seguindo a pagina hehe ! ❤️

 

               https://www.facebook.com/Tuxao0

sidneivascao

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 05/10/15Posts: 82

Help , to com erro tbm , se eu usar a pokedex em mim mesmo , da esse erro na distro , ou se usar em player tbm da erro , como faria pra bloquea essa açao ?

 

[29/06/2018 01:51:52] [Error - Action Interface] 
[29/06/2018 01:51:52] data/actions/scripts/pokedex.lua:onUse
[29/06/2018 01:51:52] Description: 
[29/06/2018 01:51:52] data/actions/scripts/pokedex.lua:58: attempt to index a boolean value
[29/06/2018 01:51:52] stack traceback:
[29/06/2018 01:51:52]     data/actions/scripts/pokedex.lua:58: in function <data/actions/scripts/pokedex.lua:3>
 

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end