Postado Março 21, 2022 3 anos bom dia pessoal eu vou postar abaixo o script do npc pokemoncollector este npc simplesmente compra os pokemons dos jogadores po Bom dia pessoal eu vou postar abaixo o script do NPC pokemoncollector este NPC simplesmente compra os pokemons dos jogadores porem por algum motivo ele compra apenas os pokemons normais por exemplo ele compra o pokemon de nome : "Charmander" mas não compra o ;"Shiny Charmander" o script simplesmente não consegue pegar na tabela o preço do shiny charmander talvez por ter duas palavras SCRIPT Citar local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 msg = firstToUpper(msg) if msgcontains(msg, 'bye') then selfSay('Ok then.', cid) npcHandler:releaseFocus(cid) elseif msgcontains(msg, 'name') or msgcontains(msg, 'sell') or msgcontains(msg, 'buy') then selfSay('Just say the name of the pokemon you wanna sell me.', cid) elseif msg == "Pikachu" then selfSay('I do not like this pokemon.', cid) else local player = Player(cid) local monsterType = MonsterType(msg) local pokePrice = { ["Charmander"] = 3000, ["Shiny Charmander"] = 30000, ["Charmeleon"] = 8000, ["Charizard"] = 18000, ["Bulbasaur"] = 3000, ["Ivysaur"] = 8000, ["Venusaur"] = 18000, ["Squirtle"] = 3000, ["Wartortle"] = 8000, ["Blastoise"] = 18000, ["Caterpie"] = 50, ["Metapod"] = 250, ["Butterfree"] = 2000, ["Weedle"] = 50, ["Kakuna"] = 250, ["Beedrill"] = 2000, ["Pidgey"] = 60, ["Pidgeotto"] = 1500, ["Pidgeot"] = 11500, ["Rattata"] = 5, ["Raticate"] = 2000, ["Spearow"] = 100, ["Fearow"] = 5100, ["Ekans"] = 300, ["Arbok"] = 3000, ["Pikachu"] = 8000, ["Raichu"] = 18000, ["Sandshrew"] = 1000, ["Sandslash"] = 11000, ["Nidoran Female"] = 125, ["Nidorina"] = 2250, ["Nidoqueen"] = 12250, ["Nidoran Male"] = 125, ["Nidorino"] = 2250, ["Nidoqueen"] = 12250, ["Clefairy"] = 8000, ["Clefable"] = 18000, ["Vulpix"] = 1000, ["Ninetales"] = 11000, ["Jigglypuff"] = 8000, ["Wigglytuff"] = 18000, ["Zubat"] = 120, ["Golbat"] = 3000, ["Oddish"] = 80, ["Gloom"] = 2250, ["Vileplume"] = 12000, ["Paras"] = 60, ["Parasect"] = 7250, ["Venonat"] = 1500, ["Venomoth"] = 7250, ["Diglett"] = 200, ["Dugtrio"] = 3000, ["Meowth"] = 300, ["Persian"] = 3000, ["Psyduck"] = 1500, ["Golduck"] = 11500, ["Mankey"] = 300, ["Primeape"] = 7250, ["Growlithe"] = 3500, ["Arcanine"] = 60000, ["Poliwag"] = 80, ["Poliwhirl"] = 3000, ["Poliwrath"] = 13000, ["Abra"] = 800, ["Kadabra"] = 5800, ["Alakazam"] = 16000, ["Machop"] = 2000, ["Machoke"] = 7000, ["Machamp"] = 17000, ["Bellsprout"] = 80, ["Wepinbell"] = 2250, ["Victreebel"] = 12000, ["Tentacool"] = 300, ["Tentacruel"] = 10000, ["Geodude"] = 300, ["Graveler"] = 5000, ["Golem"] = 15000, ["Ponyta"] = 1500, ["Rapidash"] = 6500, ["Slowpoke"] = 400, ["Slowbro"] = 8000, ["Magnemite"] = 400, ["Magneton"] = 5400, ["Farfetch'd"] = 7000, ["Doduo"] = 600, ["Dodrio"] = 5600, ["Seel"] = 2000, ["Dewgong"] = 12000, ["Grimer"] = 300, ["Muk"] = 11000, ["Shellder"] = 200, ["Cloyster"] = 10200, ["Gastly"] = 3000, ["Haunter"] = 8000, ["Gengar"] = 18000, ["Onix"] = 6000, ["Drowzee"] = 1000, ["Hypno"] = 6000, ["Krabby"] = 200, ["Kingler"] = 5200, ["Voltorb"] = 250, ["Electrode"] = 3000, ["Exeggute"] = 200, ["Exeggutor"] = 10000, ["Cubone"] = 1000, ["Marowak"] = 11000, ["Hitmonlee"] = 20000, ["Hitmonchan"] = 20000, ["Lickitung"] = 60000, ["Koffing"] = 300, ["Weezing"] = 3000, ["Rhyhorn"] = 3000, ["Rhydon"] = 13000, ["Chansey"] = 40000, ["Tangela"] = 10000, ["Kangaskhan"] = 120000, ["Horsea"] = 200, ["Seadra"] = 5500, ["Goldeen"] = 200, ["Seaking"] = 3000, ["Staryu"] = 400, ["Starmie"] = 3000, ["Mr. Mime"] = 120000, ["Scyther"] = 120000, ["Jynx"] = 120000, ["Electabuzz"] = 120000, ["Magmar"] = 120000, ["Pinsir"] = 9000, ["Tauros"] = 5000, ["Magikarp"] = 5, ["Gyarados"] = 5000, ["Lapras"] = 120000, ["Ditto"] = 70000, ["Eevee"] = 45000, ["Vaporeon"] = 50000, ["Jolteon"] = 50000, ["Flareon"] = 50000, ["Porygon"] = 60000, ["Omanyte"] = 20000, ["Omastar"] = 75000, ["Kabuto"] = 2000, ["Kabutops"] = 75000, ["Aerodactyl"] = 2000000, ["Snorlax"] = 200000, ["Dratini"] = 15000, ["Dragonair"] = 65000, ["Dragonite"] = 125000, -- Segunda Geração ["Chikorita"] = 3000, ["Bayleef"] = 8000, ["Meganium"] = 18000, ["Cydaquil"] = 3000, ["Quilava"] = 8000, ["Typhlosion"] = 18000, ["Totodile"] = 3000, ["Croconaw"] = 8000, ["Feraligatr"] = 18000, ["Sentret"] = 250, ["Furret"] = 3000, ["Hoothoot"] = 1500, ["Noctowl"] = 11500, ["Ledyba"] = 250, ["Ledian"] = 3000, ["Spinarak"] = 250, ["Ariados"] = 3000, ["Crobat"] = 58000, ["Chinchou"] = 1000, ["Lanturn"] = 6000, ["Pichu"] = 3000, ["Cleffa"] = 3000, ["Igglybuff"] = 3000, ["Togepi"] = 15000, ["Togetic"] = 25000, ["Natu"] = 3000, ["Xatu"] = 130000, ["Mareep"] = 3000, ["Flaaffy"] = 8000, ["Ampharos"] = 18000, ["Bellossom"] = 12000, ["Marill"] = 3000, ["Azumarill"] = 13000, ["Sudowoodo"] = 120000, ["Politoed"] = 8000, ["Hoppip"] = 80, ["Skiploom"] = 2250, ["Jumpluff"] = 12000, ["Aipom"] = 8000, ["Sunkern"] = 50, ["Sunflora"] = 5000, ["Yanma"] = 9000, ["Wooper"] = 2000, ["Quagsire"] = 12000, ["Espeon"] = 50000, ["Umbreon"] = 50000, ["Murkrow"] = 10000, ["Slowking"] = 11000, ["Misdreavus"] = 100000, ["Wobbuffet"] = 200000, ["Girafarig"] = 120000, ["Pineco"] = 300, ["Forretress"] = 10000, ["Dunsparce"] = 3000, ["Gligar"] = 8000, ["Steelix"] = 110000, ["Snubbull"] = 22500, ["Granbull"] = 12500, ["Qwilfish"] = 10000, ["Scizor"] = 220000, ["Shuckle"] = 3500, ["Heracross"] = 120000, ["Sneasel"] = 10000, ["Teddiursa"] = 80000, ["Ursaring"] = 150000, ["Slugma"] = 1000, ["Magcargo"] = 11000, ["Swinub"] = 1000, ["Piloswine"] = 11000, ["Corsola"] = 9000, ["Remoraid"] = 200, ["Octillery"] = 10000, ["Delibird"] = 10000, ["Mantine"] = 120000, ["Skarmory"] = 120000, ["Houndour"] = 5000, ["Houndoom"] = 13500, ["kingdra"] = 70000, ["Phanpy"] = 3000, ["Donphan"] = 13000, ["Porygon2"] = 120000, ["Stantler"] = 10000, ["Tyrogue"] = 15000, ["Hitmontop"] = 50000, ["Smoochum"] = 45000, ["Elikid"] = 45000, ["Magby"] = 45000, ["Miltank"] = 120000, ["Blissey"] = 140000, ["Larvitar"] = 15000, ["Pupitar"] = 65000, ["Electivire"] = 125000, ["Magmortar"] = 125000, ["Tyranitar"] = 125000, ["Giant Magikarp"] = 50000, ["Shiny Giant Magikarp"] = 200000, -- shiny -- ["Shiny Fearow"] = 1500000, ["Shiny Vileplume"] = 1500000, ["Shiny Golem"] = 1500000, ["Shiny Nidoking"] = 1500000, ["Shiny Hypno"] = 1500000, ["Shiny Vaporeon"] = 1500000, ["Shiny Jolteon"] = 1500000, ["Shiny Flareon"] = 1500000, ["Shiny Hitmontop"] = 1500000, ["Shiny Tangrowth"] = 1500000, ["Tangrowth"] = 50000, ["Yanmega"] = 500000, } if monsterType then local balls = player:getPokeballs() for i=1, #balls do local ball = balls[i] local name = firstToUpper(ball:getSpecialAttribute("pokeName")) if name == msg then local isBallBeingUsed = ball:getSpecialAttribute("isBeingUsed") if isBallBeingUsed and isBallBeingUsed == 1 then selfSay('Sorry, not possible while using the Pokemon.', cid) return true end local boost = ball:getSpecialAttribute("pokeBoost") or 0 local level = ball:getSpecialAttribute("pokeLevel") local price = pokePrice [name] + boost * 1000 if ball:remove() then selfSay('Take ' .. price .. ' by your ' .. name .. ' boost ' .. boost .. '. Thanks!', cid) player:addMoney(price) player:refreshPokemonBar({}, {}) end return true end end selfSay('You do not have this pokemon.', cid) else selfSay('I do not like this pokemon.', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) espero que possam me ajudar. Editado Março 22, 2022 3 anos por Shambles (veja o histórico de edições)
Postado Março 26, 2022 3 anos Solução tenta verificar se não é uma simples situação de case sensitive, coloca "Shiny chsrmander " na tabela e tenta vender o pokemon também com a primeira letra da segunda palavra em minúsculo
Postado Março 28, 2022 3 anos Autor Em 25/03/2022 em 22:34, So volto tarde disse: tenta verificar se não é uma simples situação de case sensitive, coloca "Shiny chsrmander " na tabela e tenta vender o pokemon também com a primeira letra da segunda palavra em minúsculo nossa mano muito obrigado, não acredito que estou sofrendo dias por conta de algo tão bobo rsrsrs foi apenas deixar em minúsculo mesmo
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.