Ir para conteúdo

Pokedex


narutoxDDDD

Posts Recomendados

Está dando erro logo nessa parte... "if is Summon(pokemon) then" espero que me ajudem =D

 

function onUse(cid, item, fromPos, itemEx, toPos)

local pokemon = itemEx.uid
local pokemons = {
{"Bulbasaur", "1.txt", 11395, 20, 100, 99101},
{"Squirtle", "2.txt", 11401, 20, 500, 99102}, 
}

for _,n in pairs(pokemons) do
local Dex = io.open('data/pokedex/' .. n[2],'r')
   if isSummon(pokemon) then
                    if getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) >= n[4] and getPlayerStorageValue(cid, n[6]) <= 0 then 
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex")
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. n[5] .. " experience points.")
                    doPlayerAddExperience(cid, n[5])
                    setPlayerStorageValue(cid, n[6], 1)
                    elseif getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) < n[4] and getPlayerStorageValue(cid, n[6]) <= 0 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need level " .. n[4] .. " to unlock this pokemon.")
                    elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) >= 1 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    return true
                    end   
                    elseif isMonster(pokemon) then
                    if getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) <= 0 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex")
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. n[5] .. " experience points.")
                    doPlayerAddExperience(cid, n[5])
                    setPlayerStorageValue(cid, n[6], 1)
                    elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) >= 1 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    return true
                    end
   end
end  
end

 

++REP Para quem ajudar

Link para o comentário
Compartilhar em outros sites

Tente:

 

function isSummon(uid)
return isCreature(uid) and getCreatureMaster(uid) ~= uid or false
end

function onUse(cid, item, fromPos, itemEx, toPos)

local pokemon = itemEx.uid
local pokemons = {
{"Bulbasaur", "1.txt", 11395, 20, 100, 99101},
{"Squirtle", "2.txt", 11401, 20, 500, 99102}, 
}

for _,n in pairs(pokemons) do
local Dex = io.open('data/pokedex/' .. n[2],'r')
   if isSummon(pokemon) then
                    if getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) >= n[4] and getPlayerStorageValue(cid, n[6]) <= 0 then 
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex")
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. n[5] .. " experience points.")
                    doPlayerAddExperience(cid, n[5])
                    setPlayerStorageValue(cid, n[6], 1)
                    elseif getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) < n[4] and getPlayerStorageValue(cid, n[6]) <= 0 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need level " .. n[4] .. " to unlock this pokemon.")
                    elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) >= 1 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    return true
                    end   
                    elseif isMonster(pokemon) then
                    if getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) <= 0 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex")
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. n[5] .. " experience points.")
                    doPlayerAddExperience(cid, n[5])
                    setPlayerStorageValue(cid, n[6], 1)
                    elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[6]) >= 1 then
                    doShowTextDialog(cid, n[3], Dex:read("*all"))
                    return true
                    end
   end
end  

 

 

flw

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...