Ir para conteúdo
  • Cadastre-se

erro na script do comprador de pokemons


Posts Recomendados

peguei essa script:

 

Primeiro vá em Data->Npc, copie e cole qualquer arquivo.xml de lá e renomeie para comprapoke.xml, substitua o que tem dentro por isso:

<?xml version="1.0"?> <npc name="Berilo" script="data/npc/scripts/comprapoke.lua" walkinterval="5000" floorchange="0">
<health now="100" max="100"/> <look type="143" head="78" body="88" legs="0" feet="88" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hi |PLAYERNAME|, do you want to sell your {pokemon}?"/>
</parameters>
</npc>

Agora na mesma pasta vc vai ver uma outra pasta chamada scripts, vá lá copie e cole qualquer arquivo.xml de lá e renomeie para comprapoke.lua, substitua o que tem dentro por isso:

local keywordHandler = KeywordHandler:new()  local npcHandler = NpcHandler:new(keywordHandler)  NpcSystem.parseParameters(npcHandler)  local talkState = {} 
 function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end  function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end  function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end  function onThink() npcHandler:onThink() end 
 function creatureSayCallback(cid, type, msg)  if(not npcHandler:isFocused(cid)) then  return false  end 
 local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid 

 
    function pairsByKeys (t, f) -- function for alphabetical order in list
      local a = {}
      for n in pairs(t) do table.insert(a, n) end
      table.sort(a, f)
      local i = 0
      local iter = function ()
        i = i + 1

        if a == nil then return nil
        else return a, t[a]
        end
      end
      return iter
    end
 
local Pokemons = {
["mew"] = {price = 500000},
["mewtwo"] = {price = 500000},
["lugia"] = {price = 700000},
["celebi"] = {price = 500000},
["moltres"] = {price = 400000},
["zapdos"] = {price = 400000},
["articuno"] = {price = 400000},
["bayleef"] = {price = 400000},
["chikorital"] = {price = 200000},
["meganium"] = {price = 600000},
["cyndaquil"] = {price = 200000},
["quilava"] = {price = 400000},
["typhlosion"] = {price = 600000},
["teddiursa"] = {price = 200000},
["ursaring"] = {price = 500000},
["wobbuffet"] = {price = 300000},
["stantler"] = {price = 320000},
["noctowl"] = {price = 350000},
["houndour"] = {price = 100000},
["houndoom"] = {price = 300000},
["gligar"] = {price = 350000},
["hoothoot"] = {price = 150000},
["scizor"] = {price = 800000},
["steelix"] = {price = 800000},
["hitmontopl"] = {price = 800000},
["pichu"] = {price = 500000},
["tyrogue"] = {price = 500000},
["swablu"] = {price = 500000},
["suicune"] = {price = 900000},
["entei"] = {price = 900000},
["raikou"] = {price = 900000},
["skarmory"] = {price = 900000},
["electabuzz"] = {price = 50000},
["seel"] = {price = 10000},
["dewgong"] = {price = 25000},
["arcanine"] = {price = 30000},
["muk"] = {price = 20000},
["shellder"] = {price = 5000},
["cloyster"] = {price = 30000},
["onix"] = {price = 35000},
["drowzee"] = {price = 10000},
["hypno"] = {price = 25000},
["kingler"] = {price = 15000},
["corphish"] = {price = 10000},
["crawdaunt"] = {price = 20000},
["exeggutor"] = {price = 20000},
["marowak"] = {price = 25000},
["hitmonlee"] = {price = 50000},
["hitmonchan"] = {price = 50000},
["lickitung"] = {price = 40000},
["weezing"] = {price = 25000},
["rhyhorn"] = {price = 10000},
["rhydon"] = {price = 25000},
["tangela"] = {price = 20000},
["kangaskhan"] = {price = 40000},
["kingdra"] = {price = 50000},
["togepi"] = {price = 10000},
["togetic"] = {price = 20000},
["shuppet"] = {price = 10000},
["banette"] = {price = 20000},
["duskull"] = {price = 20000},
["dusclops"] = {price = 30000},
["seaking"] = {price = 15000},
["buizel"] = {price = 10000},
["starmie"] = {price = 20000},
["mime jr"] = {price = 10000},
["mr.mime"] = {price = 35000},
["scyther"] = {price = 50000},
["smoochum"] = {price = 10000},
["jynx"] = {price = 35000},
["magmar"] = {price = 50000},
["politoed"] = {price = 40000},
["poliwrath"] = {price = 30000},
["gyarados"] = {price = 30000},
["lapras"] = {price = 50000},
["eevee"] = {price = 10000},
["porygon"] = {price = 70000},
["omanyte"] = {price = 15000},
["omastar"] = {price = 50000},
["kabuto"] = {price = 15000},
["kabutops"] = {price = 50000},
["aerodactyl"] = {price = 100000},
["snorlax"] = {price = 60000},
["dratini"] = {price = 15000},
["dragonair"] = {price = 30000},
["dragonite"] = {price = 50000},
["ivysaur"] = {price = 20000},
["venusaur"] = {price = 30000},
["charmander"] = {price = 5000},
["charmeleon"] = {price = 15000},
["charizard"] = {price = 30000},
["squirtle"] = {price = 5000},
["wartortle"] = {price = 15000},
["blastoise"] = {price = 30000},
["fearow"] = {price = 20000},
["lucario"] = {price = 35000},
["arbok"] = {price = 20000},
["pikachu"] = {price = 15000},
["sandslash"] = {price = 30000},
["nidorina"] = {price = 10000},
["nidoqueen"] = {price = 25000},
["nidorino"] = {price = 10000},
["nidoking"] = {price = 25000},
["clefairy"] = {price = 15000},
["clefable"] = {price = 25000}
}
 
 local idballs = { [2532] = {2531}, [2653] = {2557},
[2654] = {2525}, [2652] = {2524}, [2195] = {2523}, [2531] = {2532}, [2557] = {2653}, [2525] = {2654}, [2524] = {2652}, [2523] = {2195},
} local balls = idballs[getPlayerSlotItem(cid,8).itemid]
 
 
 if(msgcontains(msg, "pokemon") or msgcontains(msg, "pokemon")) then
selfSay("What pokemon you want to sell? Or you might want to see a {list}?", cid) 
talkState[talkUser] = 1
elseif (msgcontains(msg, "list") or msgcontains(msg, "LIST")) and talkState[talkUser] == 1 then local str = ""
str = str .. "Pokemon Prices :\n\n" for name, pos in pairsByKeys(Pokemons) do
str = str..name.." = "..pos.price.."\n" end
str = str .. "" 
doShowTextDialog(cid, 6579, str) 
elseif Pokemons[msg]  and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, 25000) == 5 then        return selfSay('Você está montando.',cid)
elseif getPlayerStorageValue(cid, 23000) == 5 then return selfSay('Get off of your pokemon, please!',cid)
elseif #getCreatureSummons(cid) >= 1 then

return selfSay('Could call your pokemon back to the poke ball?',cid)
elseif balls == nil then return selfSay('Put your pokemon in the poke ball slot, so I can review it!',cid) end local a = getItemAttribute(getPlayerSlotItem(cid,8).uid,"name") if string.find(tostring(a),msg) then
doRemoveItem(getPlayerSlotItem(cid,8).uid, 1)
doPlayerAddMoney(cid, Pokemons[msg].price) 

selfSay('Thank you!', cid) else
selfSay('You don't have a '..msg..' for sell, sorry!', cid) end
elseif msg == "no" and talkState[talkUser] >= 1 then 
selfSay("Then not.", cid) 
talkState[talkUser] = 0 
npcHandler:releaseFocus(cid)  end  return TRUE  end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Agora vou explicar como adicionar e excluir, vcs com certeza devem estar vendo aquela parte com o nome dos pokes no segundo código. Para vc adicionar mais um basta colocar uma linha dessa em baixo:

["NOMEDOPOKE"] = {price = PREÇODOPOKE},

Então, vc deve alterar as informações acima e pronto, vc já pode editar o seu NPC que compra pokemons! ^^

Pra excluir basta apagar a linha do pokemon no script.

 

Observação: no final da linha do pokemon coloque sempre uma virgula, a não ser q o pokemon seja o ultimo da lista, se for o ultimo não vai precisar!

 

 

So que ta dando o seguinte erro na hora de carregar o server:

 

[22/06/2014 21:48:42] [Error - LuaScriptInterface::loadFile] data/npc/scripts/comprapoke.lua:149: ')' expected near 't'
[22/06/2014 21:48:42] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/comprapoke.lua
[22/06/2014 21:48:42] data/npc/scripts/comprapoke.lua:149: ')' expected near 't'

 

assim que puderem me ajudem galara por favor

abrax.

Link para o post
Compartilhar em outros sites

Tenta esse:

local keywordHandler = KeywordHandler:new()  local npcHandler = NpcHandler:new(keywordHandler)  NpcSystem.parseParameters(npcHandler)  local talkState = {} 
 function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end  function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end  function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end  function onThink() npcHandler:onThink() end 
 function creatureSayCallback(cid, type, msg)  if(not npcHandler:isFocused(cid)) then  return false  end 
 local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid 
 
    function pairsByKeys (t, f) -- function for alphabetical order in list
      local a = {}
      for n in pairs(t) do table.insert(a, n) end
      table.sort(a, f)
      local i = 0
      local iter = function ()
        i = i + 1
        if a[i] == nil then return nil
        else return a[i], t[a[i]]
        end
      end
      return iter
    end
 
local Pokemons = {
["mew"] = {price = 500000},
["mewtwo"] = {price = 500000},
["lugia"] = {price = 700000},
["celebi"] = {price = 500000},
["moltres"] = {price = 400000},
["zapdos"] = {price = 400000},
["articuno"] = {price = 400000},
["bayleef"] = {price = 400000},
["chikorital"] = {price = 200000},
["meganium"] = {price = 600000},
["cyndaquil"] = {price = 200000},
["quilava"] = {price = 400000},
["typhlosion"] = {price = 600000},
["teddiursa"] = {price = 200000},
["ursaring"] = {price = 500000},
["wobbuffet"] = {price = 300000},
["stantler"] = {price = 320000},
["noctowl"] = {price = 350000},
["houndour"] = {price = 100000},
["houndoom"] = {price = 300000},
["gligar"] = {price = 350000},
["hoothoot"] = {price = 150000},
["scizor"] = {price = 800000},
["steelix"] = {price = 800000},
["hitmontopl"] = {price = 800000},
["pichu"] = {price = 500000},
["tyrogue"] = {price = 500000},
["swablu"] = {price = 500000},
["suicune"] = {price = 900000},
["entei"] = {price = 900000},
["raikou"] = {price = 900000},
["skarmory"] = {price = 900000},
["electabuzz"] = {price = 50000},
["seel"] = {price = 10000},
["dewgong"] = {price = 25000},
["arcanine"] = {price = 30000},
["muk"] = {price = 20000},
["shellder"] = {price = 5000},
["cloyster"] = {price = 30000},
["onix"] = {price = 35000},
["drowzee"] = {price = 10000},
["hypno"] = {price = 25000},
["kingler"] = {price = 15000},
["corphish"] = {price = 10000},
["crawdaunt"] = {price = 20000},
["exeggutor"] = {price = 20000},
["marowak"] = {price = 25000},
["hitmonlee"] = {price = 50000},
["hitmonchan"] = {price = 50000},
["lickitung"] = {price = 40000},
["weezing"] = {price = 25000},
["rhyhorn"] = {price = 10000},
["rhydon"] = {price = 25000},
["tangela"] = {price = 20000},
["kangaskhan"] = {price = 40000},
["kingdra"] = {price = 50000},
["togepi"] = {price = 10000},
["togetic"] = {price = 20000},
["shuppet"] = {price = 10000},
["banette"] = {price = 20000},
["duskull"] = {price = 20000},
["dusclops"] = {price = 30000},
["seaking"] = {price = 15000},
["buizel"] = {price = 10000},
["starmie"] = {price = 20000},
["mime jr"] = {price = 10000},
["mr.mime"] = {price = 35000},
["scyther"] = {price = 50000},
["smoochum"] = {price = 10000},
["jynx"] = {price = 35000},
["magmar"] = {price = 50000},
["politoed"] = {price = 40000},
["poliwrath"] = {price = 30000},
["gyarados"] = {price = 30000},
["lapras"] = {price = 50000},
["eevee"] = {price = 10000},
["porygon"] = {price = 70000},
["omanyte"] = {price = 15000},
["omastar"] = {price = 50000},
["kabuto"] = {price = 15000},
["kabutops"] = {price = 50000},
["aerodactyl"] = {price = 100000},
["snorlax"] = {price = 60000},
["dratini"] = {price = 15000},
["dragonair"] = {price = 30000},
["dragonite"] = {price = 50000},
["ivysaur"] = {price = 20000},
["venusaur"] = {price = 30000},
["charmander"] = {price = 5000},
["charmeleon"] = {price = 15000},
["charizard"] = {price = 30000},
["squirtle"] = {price = 5000},
["wartortle"] = {price = 15000},
["blastoise"] = {price = 30000},
["fearow"] = {price = 20000},
["lucario"] = {price = 35000},
["arbok"] = {price = 20000},
["pikachu"] = {price = 15000},
["sandslash"] = {price = 30000},
["nidorina"] = {price = 10000},
["nidoqueen"] = {price = 25000},
["nidorino"] = {price = 10000},
["nidoking"] = {price = 25000},
["clefairy"] = {price = 15000},
["clefable"] = {price = 25000}
}
 
 local idballs = { [2532] = {2531}, [2653] = {2557},
[2654] = {2525}, [2652] = {2524}, [2195] = {2523}, [2531] = {2532}, [2557] = {2653}, [2525] = {2654}, [2524] = {2652}, [2523] = {2195},
} local balls = idballs[getPlayerSlotItem(cid,8).itemid]
 
 
 if(msgcontains(msg, "pokemon") or msgcontains(msg, "pokemon")) then
selfSay("What pokemon you want to sell? Or you might want to see a {list}?", cid) 
talkState[talkUser] = 1
elseif (msgcontains(msg, "list") or msgcontains(msg, "LIST")) and talkState[talkUser] == 1 then local str = ""
str = str .. "Pokemon Prices :\n\n" for name, pos in pairsByKeys(Pokemons) do
str = str..name.." = "..pos.price.."\n" end
str = str .. "" 
doShowTextDialog(cid, 6579, str) 
elseif Pokemons[msg]  and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, 25000) == 5 then        return selfSay('Você está montando.',cid)
elseif getPlayerStorageValue(cid, 23000) == 5 then return selfSay('Get off of your pokemon, please!',cid)
elseif #getCreatureSummons(cid) >= 1 then
return selfSay('Could call your pokemon back to the poke ball?',cid)
elseif balls == nil then return selfSay('Put your pokemon in the poke ball slot, so I can review it!',cid) end local a = getItemAttribute(getPlayerSlotItem(cid,8).uid,"name") if string.find(tostring(a),msg) then
doRemoveItem(getPlayerSlotItem(cid,8).uid, 1)
doPlayerAddMoney(cid, Pokemons[msg].price) 
selfSay('Thank you!', cid) else
selfSay('You dont have a '..msg..' for sell, sorry!', cid) end
elseif msg == "no" and talkState[talkUser] >= 1 then 
selfSay("Then not.", cid) 
talkState[talkUser] = 0 
npcHandler:releaseFocus(cid)  end  return TRUE  end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Link para o post
Compartilhar em outros sites

Eu acho que a 'palavra-chave' é pokemon.. Sem o acento, diga-se de passagem.

Editado por Rusherzin (veja o histórico de edições)

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Link para o post
Compartilhar em outros sites

sim vc esta certo so que me parece q o id das balls nao estao certos

22:44 Berilo: Put your pokemon in the poke ball slot, so I can review it!  eu falei o nomo do poke e le disse isso ai

coloque seu pokemon no slot da pokebola para que eu possa ve lo

eu coloquei mas nao deu certo

Editado por simahamed (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Bom, nunca mexi com Poketibia, mas, veja se o nome do pokémon está na lista. Se o ID da pokebola está alí.. Só posso te ajudar até aí ;)

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Link para o post
Compartilhar em outros sites

Rusherzin vlw msm ajudo d+++++.

(meu poketibia e com level sistem sera q isso atrapalha ou sera as ids das ball msm)

se tiver alguem que possa me ajudar com os ids das balls tem o meu rep

ai vai os ids do meu itens.xml

AJUDEM POR FAVOR

 

 

<item id="2391" article="a" name="great ball">
        <attribute key="weight" value="0" />
        <attribute key="description" value="This is a pokeball used to catch fainted pokemon. It has a 2x catch rate." />
    </item>
    <item id="2392" article="a" name="ultra ball">
        <attribute key="weight" value="0" />
        <attribute key="description" value="This is pokeball used to catch fainted pokemon. It has a 4x catch rate." />
    </item>
    <item id="556" article="a" name="master ball">
        <attribute key="weight" value="0" />
        <attribute key="description" value="This is pokeball used to catch fainted pokemon. It has a 7x catch rate." />
    </item>
    <item id="2393" article="a" name="super ball">
        <attribute key="weight" value="0" />
        <attribute key="description" value="This is pokeball used to catch fainted pokemon. It has a 3x catch rate." />
    </item>
    <item id="2394" article="a" name="normal ball">
        <attribute key="weight" value="0" />
        <attribute key="description" value="This is a pokeball used to catch fainted pokemon. It has a 1x catch rate." />

Editado por simahamed (veja o histórico de edições)
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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo