Ir para conteúdo

Featured Replies

Postado

Nossa, esse script está muito muito ruim, mas eu tentei modificar um pouco o código dele.

 

local Pokemons = {
["bulbasaur"] = {price = 3000},
["ivysaur"] = {price = 5500},
["venusaur"] = {price = 13500},
["charmander"] = {price = 3000},
["charmeleon"] = {price = 5500},
["charizard"] = {price = 13500},
["squirtle"] = {price = 3000},
["wartortle"] = {price = 5500},
["blastoise"] = {price = 13500},
["caterpie"] = {price = 0},
["metapod"] = {price = 250},
["butterfree"] = {price = 2500},
["weedle"] = {price = 0},
["kakuna"] = {price = 250},
["beedrill"] = {price = 2500},
["pidgey"] = {price = 50},
["pidgeotto"] = {price = 1500},
["pidgeot"] = {price = 8000},
["rattata"] = {price = 0},
["raticate"] = {price = 1200},
["spearow"] = {price = 150},
["fearow"] = {price = 6000},
["ekans"] = {price = 450},
["arbok"] = {price = 2500},
["pikachu"] = {price = 4000},
["raichu"] = {price = 8000},
["sandshrew"] = {price = 850},
["sandslash"] = {price = 7000},
["nidoranfe"] = {price = 250},
["nidorina"] = {price = 2000},
["nidoqueen"] = {price = 8000},
["nidoran"] = {price = 250},
["nidorino"] = {price = 2000},
["nidoking"] = {price = 8000},
["clefairy"] = {price = 3000},
["clefable"] = {price = 6000},
["vulpix"] = {price = 1200},
["ninetales"] = {price = 8500},
["jigglypuff"] = {price = 2500},
["wigglytuff"] = {price = 5500},
["zubat"] = {price = 120},
["golbat"] = {price = 2000},
["oddish"] = {price = 80},
["gloom"] = {price = 2000},
["vileplume"] = {price = 6500},
["paras"] = {price = 50},
["parasect"] = {price = 2500},
["venonat"] = {price = 1000},
["venomoth"] = {price = 4000},
["diglett"] = {price = 400},
["dugtrio"] = {price = 4000},
["meowth"] = {price = 1200},
["persian"] = {price = 4000},
["psyduck"] = {price = 1000},
["golduck"] = {price = 8000},
["mankey"] = {price = 600},
["primeape"] = {price = 5000},
["growlithe"] = {price = 3500},
["arcanine"] = {price = 10000},
["poliwag"] = {price = 110},
["poliwhirl"] = {price = 2200},
["poliwrath"] = {price = 8500},
["abra"] = {price = 800},
["kadabra"] = {price = 6000},
["alakazam"] = {price = 15000},
["machop"] = {price = 850},
["machoke"] = {price = 5000},
["machamp"] = {price = 10000},
["bellsprout"] = {price = 100},
["weepinbell"] = {price = 2000},
["victreebel"] = {price = 6500},
["tentacool"] = {price = 350},
["tentacruel"] = {price = 6000},
["geodude"] = {price = 500},
["graveler"] = {price = 2500},
["golem"] = {price = 8000},
["ponyta"] = {price = 850},
["rapidash"] = {price = 4500},
["slowpoke"] = {price = 850},
["slowbro"] = {price = 6000},
["magnemite"] = {price = 600},
["magneton"] = {price = 3200},
["doduo"] = {price = 650},
["dodrio"] = {price = 3200},
["seel"] = {price = 2000},
["dewgong"] = {price = 8000},
["grimer"] = {price = 600},
["muk"] = {price = 2200},
["shellder"] = {price = 600},
["cloyster"] = {price = 5500},
["gastly"] = {price = 3500},
["haunter"] = {price = 7000},
["gengar"] = {price = 15000},
["onix"] = {price = 10000},
["drowzee"] = {price = 1100},
["hypno"] = {price = 8000},
["krabby"] = {price = 135},
["kingler"] = {price = 4000},
["voltorb"] = {price = 450},
["electrode"] = {price = 3000},
["exeggcute"] = {price = 320},
["exeggutor"] = {price = 7000},
["cubone"] = {price = 1000},
["marowak"] = {price = 5000},
["hitmonlee"] = {price = 80000},
["hitmonchan"] = {price = 80000},
["lickitung"] = {price = 15000},
["koffing"] = {price = 500},
["weezing"] = {price = 2200},
["rhyhorn"] = {price = 1100},
["rhydon"] = {price = 6000},
["chansey"] = {price = 40000},
["tangela"] = {price = 4000},
["kangaskhan"] = {price = 40000},
["horsea"] = {price = 200},
["seadra"] = {price = 4000},
["seaking"] = {price = 3000},
["farfetchd"] = {price = 10000},
["starmie"] = {price = 4000},
["scyther"] = {price = 110000},
["jynx"] = {price = 40000},
["electabuzz"] = {price = 70000},
["magmar"] = {price = 60000},
["pinsir"] = {price = 4000},
["tauros"] = {price = 2500},
["magikarp"] = {price = 0},
["gyarados"] = {price = 40000},
["lapras"] = {price = 110000},
["ditto"] = {price = 70000},
["eevee"] = {price = 45000},
["vaporeon"] = {price = 50000},
["jolteon"] = {price = 50000},
["flareon"] = {price = 50000},
["porygon"] = {price = 60000},
["omanyte"] = {price = 18000},
["omastar"] = {price = 50000},
["kabuto"] = {price = 18000},
["kabutops"] = {price = 50000},
["aerodactyl"] = {price = 500000},
["snorlax"] = {price = 130000},
["dratini"] = {price = 35000},
["dragonair"] = {price = 50000},
["mr mime"] = {price = 50000},
["dragonite"] = {price = 120000},
["chikorita"] = {price = 11500},
["bayleef"] = {price = 15000},
["meganium"] = {price = 29000},
["cyndaquil"] = {price = 13500},
["quilava"] = {price = 15000},
["typhlosion"] = {price = 25000},
["totodile"] = {price = 15500},
["croconaw"] = {price = 18000},
["feraligatr"] = {price = 25000},
["sentret"] = {price = 1700},
["furret"] = {price = 4200},
["hoothoot"] = {price = 1500},
["noctowl"] = {price = 5300},
["ledyba"] = {price = 1700},
["ledian"] = {price = 4500},
["spinarak"] = {price = 2800},
["ariados"] = {price = 8500},
["crobat"] = {price = 8500},
["chinchou"] = {price = 12500},
["lanturn"] = {price = 25000},
["pichu"] = {price = 1000},
["cleffa"] = {price = 800},
["igglybuff"] = {price = 800},
["toggepi"] = {price = 50000},
["togetic"] = {price = 75000},
["natu"] = {price = 2000},
["xatu"] = {price = 8000},
["mareep"] = {price = 50000},
["flaaffy"] = {price = 70000},
["ampharos"] = {price = 140000},
["bellossom"] = {price = 40000},
["sunkern"] = {price = 40000},
["sunflora"] = {price = 50000},
["marill"] = {price = 2500},
["azumarill"] = {price = 7000},
["sudowoodo"] = {price = 240000},
["politoed"] = {price = 70000},
["espeon"] = {price = 70000},
["umbreon"] = {price = 70000},
["slowking"] = {price = 70000},
["girafarig"] = {price = 50000},
["steelix"] = {price = 25000},
["snubbull"] = {price = 10000},
["granbull"] = {price = 70000},
["scizor"] = {price = 220000},
["heracross"] = {price = 50000},
["teddiursa"] = {price = 90000},
["ursaring"] = {price = 290000},
["corsola"] = {price = 110000},
["houndoom"] = {price = 20000},
["houndour"] = {price = 7000},
["kingdra"] = {price = 69000},
["miltank"] = {price = 180000},
["blissey"] = {price = 150000},
["larvitar"] = {price = 95000},
["pupitar"] = {price = 145000},
["tyranitar"] = {price = 340000},
["skiploom"] = {price = 105000},
["Jumpluff"] = {price = 115000},
["hoppip"] = {price = 95000},
}

local validBalls = {2224, 2227, 2657, 2658, 2659, 2222, 2651, 2653, 2220, 2655}

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 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
 
 
function sellPokemon(cid, name)
    for i = 1, #validBalls do
        for _, ball in (getPlayerItems(cid, validBalls)) do
            if(getItemAttribute(ball.uid, "name") == name then
                
                doRemoveItem(ball.uid)
                doPlayerAddMoney(cid, Pokemons[name].price)
                selfSay("Obrigado por me vender esse maravilhoso pokemon! Aqui esta seu dinheiro.")
                return true
                break
            end
        end
    end
end
 
selfSay("Voce nao tem um(a) ("..pokename..")! Certifique-se que ele esteja vivo e dentro de sua mochila!")
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
 
if msgcontains(string.lower(msg), "pokemon") or msgcontains(string.lower(msg), "help") or msgcontains(string.lower(msg), "sell") then
selfSay("Voce quer me vender algum pokemon? Diga {list} para ver os pokemons que eu compro!")
talkState[talkUser] = 1
elseif msgcontains(msg, "list") or msgcontains(msg, "LIST") 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 talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) > 1 then       
return selfSay("Please dont possible selling pokemons, you fly/ride")
elseif #getCreatureSummons(cid) >= 1 then
return selfSay("Por favor, chame seu pokemon para a ball e mova para sua mochila!")
end
local pokemonsell = Pokemons[string.lower(msg)]
if not pokemonsell then
return selfSay("Me desculpe mas eu nao compro esse pokemon!")
end
sellPokemon(cid, string.lower(msg), pokemonsell.price)
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Then not")
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Tony Araújo  ;D 

 

  • Respostas 17
  • Visualizações 559
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado
  • Autor

 

Nossa, esse script está muito muito ruim, mas eu tentei modificar um pouco o código dele.

 

local Pokemons = {

["bulbasaur"] = {price = 3000},

["ivysaur"] = {price = 5500},

["venusaur"] = {price = 13500},

["charmander"] = {price = 3000},

["charmeleon"] = {price = 5500},

["charizard"] = {price = 13500},

["squirtle"] = {price = 3000},

["wartortle"] = {price = 5500},

["blastoise"] = {price = 13500},

["caterpie"] = {price = 0},

["metapod"] = {price = 250},

["butterfree"] = {price = 2500},

["weedle"] = {price = 0},

["kakuna"] = {price = 250},

["beedrill"] = {price = 2500},

["pidgey"] = {price = 50},

["pidgeotto"] = {price = 1500},

["pidgeot"] = {price = 8000},

["rattata"] = {price = 0},

["raticate"] = {price = 1200},

["spearow"] = {price = 150},

["fearow"] = {price = 6000},

["ekans"] = {price = 450},

["arbok"] = {price = 2500},

["pikachu"] = {price = 4000},

["raichu"] = {price = 8000},

["sandshrew"] = {price = 850},

["sandslash"] = {price = 7000},

["nidoranfe"] = {price = 250},

["nidorina"] = {price = 2000},

["nidoqueen"] = {price = 8000},

["nidoran"] = {price = 250},

["nidorino"] = {price = 2000},

["nidoking"] = {price = 8000},

["clefairy"] = {price = 3000},

["clefable"] = {price = 6000},

["vulpix"] = {price = 1200},

["ninetales"] = {price = 8500},

["jigglypuff"] = {price = 2500},

["wigglytuff"] = {price = 5500},

["zubat"] = {price = 120},

["golbat"] = {price = 2000},

["oddish"] = {price = 80},

["gloom"] = {price = 2000},

["vileplume"] = {price = 6500},

["paras"] = {price = 50},

["parasect"] = {price = 2500},

["venonat"] = {price = 1000},

["venomoth"] = {price = 4000},

["diglett"] = {price = 400},

["dugtrio"] = {price = 4000},

["meowth"] = {price = 1200},

["persian"] = {price = 4000},

["psyduck"] = {price = 1000},

["golduck"] = {price = 8000},

["mankey"] = {price = 600},

["primeape"] = {price = 5000},

["growlithe"] = {price = 3500},

["arcanine"] = {price = 10000},

["poliwag"] = {price = 110},

["poliwhirl"] = {price = 2200},

["poliwrath"] = {price = 8500},

["abra"] = {price = 800},

["kadabra"] = {price = 6000},

["alakazam"] = {price = 15000},

["machop"] = {price = 850},

["machoke"] = {price = 5000},

["machamp"] = {price = 10000},

["bellsprout"] = {price = 100},

["weepinbell"] = {price = 2000},

["victreebel"] = {price = 6500},

["tentacool"] = {price = 350},

["tentacruel"] = {price = 6000},

["geodude"] = {price = 500},

["graveler"] = {price = 2500},

["golem"] = {price = 8000},

["ponyta"] = {price = 850},

["rapidash"] = {price = 4500},

["slowpoke"] = {price = 850},

["slowbro"] = {price = 6000},

["magnemite"] = {price = 600},

["magneton"] = {price = 3200},

["doduo"] = {price = 650},

["dodrio"] = {price = 3200},

["seel"] = {price = 2000},

["dewgong"] = {price = 8000},

["grimer"] = {price = 600},

["muk"] = {price = 2200},

["shellder"] = {price = 600},

["cloyster"] = {price = 5500},

["gastly"] = {price = 3500},

["haunter"] = {price = 7000},

["gengar"] = {price = 15000},

["onix"] = {price = 10000},

["drowzee"] = {price = 1100},

["hypno"] = {price = 8000},

["krabby"] = {price = 135},

["kingler"] = {price = 4000},

["voltorb"] = {price = 450},

["electrode"] = {price = 3000},

["exeggcute"] = {price = 320},

["exeggutor"] = {price = 7000},

["cubone"] = {price = 1000},

["marowak"] = {price = 5000},

["hitmonlee"] = {price = 80000},

["hitmonchan"] = {price = 80000},

["lickitung"] = {price = 15000},

["koffing"] = {price = 500},

["weezing"] = {price = 2200},

["rhyhorn"] = {price = 1100},

["rhydon"] = {price = 6000},

["chansey"] = {price = 40000},

["tangela"] = {price = 4000},

["kangaskhan"] = {price = 40000},

["horsea"] = {price = 200},

["seadra"] = {price = 4000},

["seaking"] = {price = 3000},

["farfetchd"] = {price = 10000},

["starmie"] = {price = 4000},

["scyther"] = {price = 110000},

["jynx"] = {price = 40000},

["electabuzz"] = {price = 70000},

["magmar"] = {price = 60000},

["pinsir"] = {price = 4000},

["tauros"] = {price = 2500},

["magikarp"] = {price = 0},

["gyarados"] = {price = 40000},

["lapras"] = {price = 110000},

["ditto"] = {price = 70000},

["eevee"] = {price = 45000},

["vaporeon"] = {price = 50000},

["jolteon"] = {price = 50000},

["flareon"] = {price = 50000},

["porygon"] = {price = 60000},

["omanyte"] = {price = 18000},

["omastar"] = {price = 50000},

["kabuto"] = {price = 18000},

["kabutops"] = {price = 50000},

["aerodactyl"] = {price = 500000},

["snorlax"] = {price = 130000},

["dratini"] = {price = 35000},

["dragonair"] = {price = 50000},

["mr mime"] = {price = 50000},

["dragonite"] = {price = 120000},

["chikorita"] = {price = 11500},

["bayleef"] = {price = 15000},

["meganium"] = {price = 29000},

["cyndaquil"] = {price = 13500},

["quilava"] = {price = 15000},

["typhlosion"] = {price = 25000},

["totodile"] = {price = 15500},

["croconaw"] = {price = 18000},

["feraligatr"] = {price = 25000},

["sentret"] = {price = 1700},

["furret"] = {price = 4200},

["hoothoot"] = {price = 1500},

["noctowl"] = {price = 5300},

["ledyba"] = {price = 1700},

["ledian"] = {price = 4500},

["spinarak"] = {price = 2800},

["ariados"] = {price = 8500},

["crobat"] = {price = 8500},

["chinchou"] = {price = 12500},

["lanturn"] = {price = 25000},

["pichu"] = {price = 1000},

["cleffa"] = {price = 800},

["igglybuff"] = {price = 800},

["toggepi"] = {price = 50000},

["togetic"] = {price = 75000},

["natu"] = {price = 2000},

["xatu"] = {price = 8000},

["mareep"] = {price = 50000},

["flaaffy"] = {price = 70000},

["ampharos"] = {price = 140000},

["bellossom"] = {price = 40000},

["sunkern"] = {price = 40000},

["sunflora"] = {price = 50000},

["marill"] = {price = 2500},

["azumarill"] = {price = 7000},

["sudowoodo"] = {price = 240000},

["politoed"] = {price = 70000},

["espeon"] = {price = 70000},

["umbreon"] = {price = 70000},

["slowking"] = {price = 70000},

["girafarig"] = {price = 50000},

["steelix"] = {price = 25000},

["snubbull"] = {price = 10000},

["granbull"] = {price = 70000},

["scizor"] = {price = 220000},

["heracross"] = {price = 50000},

["teddiursa"] = {price = 90000},

["ursaring"] = {price = 290000},

["corsola"] = {price = 110000},

["houndoom"] = {price = 20000},

["houndour"] = {price = 7000},

["kingdra"] = {price = 69000},

["miltank"] = {price = 180000},

["blissey"] = {price = 150000},

["larvitar"] = {price = 95000},

["pupitar"] = {price = 145000},

["tyranitar"] = {price = 340000},

["skiploom"] = {price = 105000},

["Jumpluff"] = {price = 115000},

["hoppip"] = {price = 95000},

}

local validBalls = {2224, 2227, 2657, 2658, 2659, 2222, 2651, 2653, 2220, 2655}

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 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

 

 

function sellPokemon(cid, name)

    for i = 1, #validBalls do

        for _, ball in (getPlayerItems(cid, validBalls)) do

            if(getItemAttribute(ball.uid, "name") == name then

                

                doRemoveItem(ball.uid)

                doPlayerAddMoney(cid, Pokemons[name].price)

                selfSay("Obrigado por me vender esse maravilhoso pokemon! Aqui esta seu dinheiro.")

                return true

                break

            end

        end

    end

end

 

selfSay("Voce nao tem um(a) ("..pokename..")! Certifique-se que ele esteja vivo e dentro de sua mochila!")

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

 

if msgcontains(string.lower(msg), "pokemon") or msgcontains(string.lower(msg), "help") or msgcontains(string.lower(msg), "sell") then

selfSay("Voce quer me vender algum pokemon? Diga {list} para ver os pokemons que eu compro!")

talkState[talkUser] = 1

elseif msgcontains(msg, "list") or msgcontains(msg, "LIST") 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 talkState[talkUser] == 1 then

if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) > 1 then       

return selfSay("Please dont possible selling pokemons, you fly/ride")

elseif #getCreatureSummons(cid) >= 1 then

return selfSay("Por favor, chame seu pokemon para a ball e mova para sua mochila!")

end

local pokemonsell = Pokemons[string.lower(msg)]

if not pokemonsell then

return selfSay("Me desculpe mas eu nao compro esse pokemon!")

end

sellPokemon(cid, string.lower(msg), pokemonsell.price)

elseif msg == "no" and talkState[talkUser] >= 1 then

selfSay("Then not")

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Eu peguei esse Script do Server Pokémon KPDO e estou tentando adaptar ele pro meu Erondino V15 (Pokémon Dash), vou testar essa sua correção aqui!

 

Nossa, esse script está muito muito ruim, mas eu tentei modificar um pouco o código dele.

 

local Pokemons = {

["bulbasaur"] = {price = 3000},

["ivysaur"] = {price = 5500},

["venusaur"] = {price = 13500},

["charmander"] = {price = 3000},

["charmeleon"] = {price = 5500},

["charizard"] = {price = 13500},

["squirtle"] = {price = 3000},

["wartortle"] = {price = 5500},

["blastoise"] = {price = 13500},

["caterpie"] = {price = 0},

["metapod"] = {price = 250},

["butterfree"] = {price = 2500},

["weedle"] = {price = 0},

["kakuna"] = {price = 250},

["beedrill"] = {price = 2500},

["pidgey"] = {price = 50},

["pidgeotto"] = {price = 1500},

["pidgeot"] = {price = 8000},

["rattata"] = {price = 0},

["raticate"] = {price = 1200},

["spearow"] = {price = 150},

["fearow"] = {price = 6000},

["ekans"] = {price = 450},

["arbok"] = {price = 2500},

["pikachu"] = {price = 4000},

["raichu"] = {price = 8000},

["sandshrew"] = {price = 850},

["sandslash"] = {price = 7000},

["nidoranfe"] = {price = 250},

["nidorina"] = {price = 2000},

["nidoqueen"] = {price = 8000},

["nidoran"] = {price = 250},

["nidorino"] = {price = 2000},

["nidoking"] = {price = 8000},

["clefairy"] = {price = 3000},

["clefable"] = {price = 6000},

["vulpix"] = {price = 1200},

["ninetales"] = {price = 8500},

["jigglypuff"] = {price = 2500},

["wigglytuff"] = {price = 5500},

["zubat"] = {price = 120},

["golbat"] = {price = 2000},

["oddish"] = {price = 80},

["gloom"] = {price = 2000},

["vileplume"] = {price = 6500},

["paras"] = {price = 50},

["parasect"] = {price = 2500},

["venonat"] = {price = 1000},

["venomoth"] = {price = 4000},

["diglett"] = {price = 400},

["dugtrio"] = {price = 4000},

["meowth"] = {price = 1200},

["persian"] = {price = 4000},

["psyduck"] = {price = 1000},

["golduck"] = {price = 8000},

["mankey"] = {price = 600},

["primeape"] = {price = 5000},

["growlithe"] = {price = 3500},

["arcanine"] = {price = 10000},

["poliwag"] = {price = 110},

["poliwhirl"] = {price = 2200},

["poliwrath"] = {price = 8500},

["abra"] = {price = 800},

["kadabra"] = {price = 6000},

["alakazam"] = {price = 15000},

["machop"] = {price = 850},

["machoke"] = {price = 5000},

["machamp"] = {price = 10000},

["bellsprout"] = {price = 100},

["weepinbell"] = {price = 2000},

["victreebel"] = {price = 6500},

["tentacool"] = {price = 350},

["tentacruel"] = {price = 6000},

["geodude"] = {price = 500},

["graveler"] = {price = 2500},

["golem"] = {price = 8000},

["ponyta"] = {price = 850},

["rapidash"] = {price = 4500},

["slowpoke"] = {price = 850},

["slowbro"] = {price = 6000},

["magnemite"] = {price = 600},

["magneton"] = {price = 3200},

["doduo"] = {price = 650},

["dodrio"] = {price = 3200},

["seel"] = {price = 2000},

["dewgong"] = {price = 8000},

["grimer"] = {price = 600},

["muk"] = {price = 2200},

["shellder"] = {price = 600},

["cloyster"] = {price = 5500},

["gastly"] = {price = 3500},

["haunter"] = {price = 7000},

["gengar"] = {price = 15000},

["onix"] = {price = 10000},

["drowzee"] = {price = 1100},

["hypno"] = {price = 8000},

["krabby"] = {price = 135},

["kingler"] = {price = 4000},

["voltorb"] = {price = 450},

["electrode"] = {price = 3000},

["exeggcute"] = {price = 320},

["exeggutor"] = {price = 7000},

["cubone"] = {price = 1000},

["marowak"] = {price = 5000},

["hitmonlee"] = {price = 80000},

["hitmonchan"] = {price = 80000},

["lickitung"] = {price = 15000},

["koffing"] = {price = 500},

["weezing"] = {price = 2200},

["rhyhorn"] = {price = 1100},

["rhydon"] = {price = 6000},

["chansey"] = {price = 40000},

["tangela"] = {price = 4000},

["kangaskhan"] = {price = 40000},

["horsea"] = {price = 200},

["seadra"] = {price = 4000},

["seaking"] = {price = 3000},

["farfetchd"] = {price = 10000},

["starmie"] = {price = 4000},

["scyther"] = {price = 110000},

["jynx"] = {price = 40000},

["electabuzz"] = {price = 70000},

["magmar"] = {price = 60000},

["pinsir"] = {price = 4000},

["tauros"] = {price = 2500},

["magikarp"] = {price = 0},

["gyarados"] = {price = 40000},

["lapras"] = {price = 110000},

["ditto"] = {price = 70000},

["eevee"] = {price = 45000},

["vaporeon"] = {price = 50000},

["jolteon"] = {price = 50000},

["flareon"] = {price = 50000},

["porygon"] = {price = 60000},

["omanyte"] = {price = 18000},

["omastar"] = {price = 50000},

["kabuto"] = {price = 18000},

["kabutops"] = {price = 50000},

["aerodactyl"] = {price = 500000},

["snorlax"] = {price = 130000},

["dratini"] = {price = 35000},

["dragonair"] = {price = 50000},

["mr mime"] = {price = 50000},

["dragonite"] = {price = 120000},

["chikorita"] = {price = 11500},

["bayleef"] = {price = 15000},

["meganium"] = {price = 29000},

["cyndaquil"] = {price = 13500},

["quilava"] = {price = 15000},

["typhlosion"] = {price = 25000},

["totodile"] = {price = 15500},

["croconaw"] = {price = 18000},

["feraligatr"] = {price = 25000},

["sentret"] = {price = 1700},

["furret"] = {price = 4200},

["hoothoot"] = {price = 1500},

["noctowl"] = {price = 5300},

["ledyba"] = {price = 1700},

["ledian"] = {price = 4500},

["spinarak"] = {price = 2800},

["ariados"] = {price = 8500},

["crobat"] = {price = 8500},

["chinchou"] = {price = 12500},

["lanturn"] = {price = 25000},

["pichu"] = {price = 1000},

["cleffa"] = {price = 800},

["igglybuff"] = {price = 800},

["toggepi"] = {price = 50000},

["togetic"] = {price = 75000},

["natu"] = {price = 2000},

["xatu"] = {price = 8000},

["mareep"] = {price = 50000},

["flaaffy"] = {price = 70000},

["ampharos"] = {price = 140000},

["bellossom"] = {price = 40000},

["sunkern"] = {price = 40000},

["sunflora"] = {price = 50000},

["marill"] = {price = 2500},

["azumarill"] = {price = 7000},

["sudowoodo"] = {price = 240000},

["politoed"] = {price = 70000},

["espeon"] = {price = 70000},

["umbreon"] = {price = 70000},

["slowking"] = {price = 70000},

["girafarig"] = {price = 50000},

["steelix"] = {price = 25000},

["snubbull"] = {price = 10000},

["granbull"] = {price = 70000},

["scizor"] = {price = 220000},

["heracross"] = {price = 50000},

["teddiursa"] = {price = 90000},

["ursaring"] = {price = 290000},

["corsola"] = {price = 110000},

["houndoom"] = {price = 20000},

["houndour"] = {price = 7000},

["kingdra"] = {price = 69000},

["miltank"] = {price = 180000},

["blissey"] = {price = 150000},

["larvitar"] = {price = 95000},

["pupitar"] = {price = 145000},

["tyranitar"] = {price = 340000},

["skiploom"] = {price = 105000},

["Jumpluff"] = {price = 115000},

["hoppip"] = {price = 95000},

}

local validBalls = {2224, 2227, 2657, 2658, 2659, 2222, 2651, 2653, 2220, 2655}

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 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

 

 

function sellPokemon(cid, name)

    for i = 1, #validBalls do

        for _, ball in (getPlayerItems(cid, validBalls)) do

            if(getItemAttribute(ball.uid, "name") == name then

                

                doRemoveItem(ball.uid)

                doPlayerAddMoney(cid, Pokemons[name].price)

                selfSay("Obrigado por me vender esse maravilhoso pokemon! Aqui esta seu dinheiro.")

                return true

                break

            end

        end

    end

end

 

selfSay("Voce nao tem um(a) ("..pokename..")! Certifique-se que ele esteja vivo e dentro de sua mochila!")

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

 

if msgcontains(string.lower(msg), "pokemon") or msgcontains(string.lower(msg), "help") or msgcontains(string.lower(msg), "sell") then

selfSay("Voce quer me vender algum pokemon? Diga {list} para ver os pokemons que eu compro!")

talkState[talkUser] = 1

elseif msgcontains(msg, "list") or msgcontains(msg, "LIST") 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 talkState[talkUser] == 1 then

if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) > 1 then       

return selfSay("Please dont possible selling pokemons, you fly/ride")

elseif #getCreatureSummons(cid) >= 1 then

return selfSay("Por favor, chame seu pokemon para a ball e mova para sua mochila!")

end

local pokemonsell = Pokemons[string.lower(msg)]

if not pokemonsell then

return selfSay("Me desculpe mas eu nao compro esse pokemon!")

end

sellPokemon(cid, string.lower(msg), pokemonsell.price)

elseif msg == "no" and talkState[talkUser] >= 1 then

selfSay("Then not")

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Agora não quer nem carregar o Script!

 

[09/01/2015 16:01:02] [Error - LuaScriptInterface::loadFile] data/npc/scripts/buy_pokemons.lua:238: ')' expected near 'then'
[09/01/2015 16:01:02] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/buy_pokemons.lua
[09/01/2015 16:01:02] data/npc/scripts/buy_pokemons.lua:238: ')' expected near 'then'
Postado

Tenta assim:

local Pokemons = {
["bulbasaur"] = {price = 3000},
["ivysaur"] = {price = 5500},
["venusaur"] = {price = 13500},
["charmander"] = {price = 3000},
["charmeleon"] = {price = 5500},
["charizard"] = {price = 13500},
["squirtle"] = {price = 3000},
["wartortle"] = {price = 5500},
["blastoise"] = {price = 13500},
["caterpie"] = {price = 0},
["metapod"] = {price = 250},
["butterfree"] = {price = 2500},
["weedle"] = {price = 0},
["kakuna"] = {price = 250},
["beedrill"] = {price = 2500},
["pidgey"] = {price = 50},
["pidgeotto"] = {price = 1500},
["pidgeot"] = {price = 8000},
["rattata"] = {price = 0},
["raticate"] = {price = 1200},
["spearow"] = {price = 150},
["fearow"] = {price = 6000},
["ekans"] = {price = 450},
["arbok"] = {price = 2500},
["pikachu"] = {price = 4000},
["raichu"] = {price = 8000},
["sandshrew"] = {price = 850},
["sandslash"] = {price = 7000},
["nidoranfe"] = {price = 250},
["nidorina"] = {price = 2000},
["nidoqueen"] = {price = 8000},
["nidoran"] = {price = 250},
["nidorino"] = {price = 2000},
["nidoking"] = {price = 8000},
["clefairy"] = {price = 3000},
["clefable"] = {price = 6000},
["vulpix"] = {price = 1200},
["ninetales"] = {price = 8500},
["jigglypuff"] = {price = 2500},
["wigglytuff"] = {price = 5500},
["zubat"] = {price = 120},
["golbat"] = {price = 2000},
["oddish"] = {price = 80},
["gloom"] = {price = 2000},
["vileplume"] = {price = 6500},
["paras"] = {price = 50},
["parasect"] = {price = 2500},
["venonat"] = {price = 1000},
["venomoth"] = {price = 4000},
["diglett"] = {price = 400},
["dugtrio"] = {price = 4000},
["meowth"] = {price = 1200},
["persian"] = {price = 4000},
["psyduck"] = {price = 1000},
["golduck"] = {price = 8000},
["mankey"] = {price = 600},
["primeape"] = {price = 5000},
["growlithe"] = {price = 3500},
["arcanine"] = {price = 10000},
["poliwag"] = {price = 110},
["poliwhirl"] = {price = 2200},
["poliwrath"] = {price = 8500},
["abra"] = {price = 800},
["kadabra"] = {price = 6000},
["alakazam"] = {price = 15000},
["machop"] = {price = 850},
["machoke"] = {price = 5000},
["machamp"] = {price = 10000},
["bellsprout"] = {price = 100},
["weepinbell"] = {price = 2000},
["victreebel"] = {price = 6500},
["tentacool"] = {price = 350},
["tentacruel"] = {price = 6000},
["geodude"] = {price = 500},
["graveler"] = {price = 2500},
["golem"] = {price = 8000},
["ponyta"] = {price = 850},
["rapidash"] = {price = 4500},
["slowpoke"] = {price = 850},
["slowbro"] = {price = 6000},
["magnemite"] = {price = 600},
["magneton"] = {price = 3200},
["doduo"] = {price = 650},
["dodrio"] = {price = 3200},
["seel"] = {price = 2000},
["dewgong"] = {price = 8000},
["grimer"] = {price = 600},
["muk"] = {price = 2200},
["shellder"] = {price = 600},
["cloyster"] = {price = 5500},
["gastly"] = {price = 3500},
["haunter"] = {price = 7000},
["gengar"] = {price = 15000},
["onix"] = {price = 10000},
["drowzee"] = {price = 1100},
["hypno"] = {price = 8000},
["krabby"] = {price = 135},
["kingler"] = {price = 4000},
["voltorb"] = {price = 450},
["electrode"] = {price = 3000},
["exeggcute"] = {price = 320},
["exeggutor"] = {price = 7000},
["cubone"] = {price = 1000},
["marowak"] = {price = 5000},
["hitmonlee"] = {price = 80000},
["hitmonchan"] = {price = 80000},
["lickitung"] = {price = 15000},
["koffing"] = {price = 500},
["weezing"] = {price = 2200},
["rhyhorn"] = {price = 1100},
["rhydon"] = {price = 6000},
["chansey"] = {price = 40000},
["tangela"] = {price = 4000},
["kangaskhan"] = {price = 40000},
["horsea"] = {price = 200},
["seadra"] = {price = 4000},
["seaking"] = {price = 3000},
["farfetchd"] = {price = 10000},
["starmie"] = {price = 4000},
["scyther"] = {price = 110000},
["jynx"] = {price = 40000},
["electabuzz"] = {price = 70000},
["magmar"] = {price = 60000},
["pinsir"] = {price = 4000},
["tauros"] = {price = 2500},
["magikarp"] = {price = 0},
["gyarados"] = {price = 40000},
["lapras"] = {price = 110000},
["ditto"] = {price = 70000},
["eevee"] = {price = 45000},
["vaporeon"] = {price = 50000},
["jolteon"] = {price = 50000},
["flareon"] = {price = 50000},
["porygon"] = {price = 60000},
["omanyte"] = {price = 18000},
["omastar"] = {price = 50000},
["kabuto"] = {price = 18000},
["kabutops"] = {price = 50000},
["aerodactyl"] = {price = 500000},
["snorlax"] = {price = 130000},
["dratini"] = {price = 35000},
["dragonair"] = {price = 50000},
["mr mime"] = {price = 50000},
["dragonite"] = {price = 120000},
["chikorita"] = {price = 11500},
["bayleef"] = {price = 15000},
["meganium"] = {price = 29000},
["cyndaquil"] = {price = 13500},
["quilava"] = {price = 15000},
["typhlosion"] = {price = 25000},
["totodile"] = {price = 15500},
["croconaw"] = {price = 18000},
["feraligatr"] = {price = 25000},
["sentret"] = {price = 1700},
["furret"] = {price = 4200},
["hoothoot"] = {price = 1500},
["noctowl"] = {price = 5300},
["ledyba"] = {price = 1700},
["ledian"] = {price = 4500},
["spinarak"] = {price = 2800},
["ariados"] = {price = 8500},
["crobat"] = {price = 8500},
["chinchou"] = {price = 12500},
["lanturn"] = {price = 25000},
["pichu"] = {price = 1000},
["cleffa"] = {price = 800},
["igglybuff"] = {price = 800},
["toggepi"] = {price = 50000},
["togetic"] = {price = 75000},
["natu"] = {price = 2000},
["xatu"] = {price = 8000},
["mareep"] = {price = 50000},
["flaaffy"] = {price = 70000},
["ampharos"] = {price = 140000},
["bellossom"] = {price = 40000},
["sunkern"] = {price = 40000},
["sunflora"] = {price = 50000},
["marill"] = {price = 2500},
["azumarill"] = {price = 7000},
["sudowoodo"] = {price = 240000},
["politoed"] = {price = 70000},
["espeon"] = {price = 70000},
["umbreon"] = {price = 70000},
["slowking"] = {price = 70000},
["girafarig"] = {price = 50000},
["steelix"] = {price = 25000},
["snubbull"] = {price = 10000},
["granbull"] = {price = 70000},
["scizor"] = {price = 220000},
["heracross"] = {price = 50000},
["teddiursa"] = {price = 90000},
["ursaring"] = {price = 290000},
["corsola"] = {price = 110000},
["houndoom"] = {price = 20000},
["houndour"] = {price = 7000},
["kingdra"] = {price = 69000},
["miltank"] = {price = 180000},
["blissey"] = {price = 150000},
["larvitar"] = {price = 95000},
["pupitar"] = {price = 145000},
["tyranitar"] = {price = 340000},
["skiploom"] = {price = 105000},
["Jumpluff"] = {price = 115000},
["hoppip"] = {price = 95000},
}

local validBalls = {2224, 2227, 2657, 2658, 2659, 2222, 2651, 2653, 2220, 2655}

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 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
 
 
function sellPokemon(cid, name)
    for i = 1, #validBalls do
        for _, ball in (getPlayerItems(cid, validBalls[i])) do
            if(getItemAttribute(ball.uid, "name") == name) then
                
                doRemoveItem(ball.uid)
                doPlayerAddMoney(cid, Pokemons[name].price)
                selfSay("Obrigado por me vender esse maravilhoso pokemon! Aqui esta seu dinheiro.")
                return true
                break
            end
        end
    end
 
selfSay("Voce nao tem um(a) ("..pokename..")! Certifique-se que ele esteja vivo e dentro de sua mochila!")
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
 
if msgcontains(string.lower(msg), "pokemon") or msgcontains(string.lower(msg), "help") or msgcontains(string.lower(msg), "sell") then
selfSay("Voce quer me vender algum pokemon? Diga {list} para ver os pokemons que eu compro!")
talkState[talkUser] = 1
elseif msgcontains(msg, "list") or msgcontains(msg, "LIST") 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 talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) > 1 then       
return selfSay("Please dont possible selling pokemons, you fly/ride")
elseif #getCreatureSummons(cid) >= 1 then
return selfSay("Por favor, chame seu pokemon para a ball e mova para sua mochila!")
end
local pokemonsell = Pokemons[string.lower(msg)]
if not pokemonsell then
return selfSay("Me desculpe mas eu nao compro esse pokemon!")
end
sellPokemon(cid, string.lower(msg), pokemonsell.price)
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Then not")
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Tinha um erro no escopo aí tentei arrumar rapidão, ñ li o script, então pf teste tudo que o npc faz.

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

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Postado
  • Autor

 

Nossa verdade, eu tinha esquecido de fechar os parênteses.

 

Usei o script que o amigo mandou a cima e está dando esse erro!

 

[09/01/2015 16:57:30] [Error - LuaScriptInterface::loadFile] data/npc/scripts/buy_pokemons.lua:244: 'end' expected (to close 'if' at line 238) near 'break'
[09/01/2015 16:57:30] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/buy_pokemons.lua
[09/01/2015 16:57:30] data/npc/scripts/buy_pokemons.lua:244: 'end' expected (to close 'if' at line 238) near 'break'

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo