ui vlw pelo report kk
acha essa parte ali..
function sellPokemon(cid, name, price) local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
e adiciona isso logo embaixo...
if #getCreatureSummons(cid) >= 1 then
selfSay("Back your pokemon to do that!")
focus = 0
return true
end
ve se da certo...







info
Grupo: Conde
Registrado: 25/04/12
Posts: 752
Reputação: +125
Gênero: Masculino
Tipo o cara via lá e vende o pokemon que ta pra FORA da ball, ai o npc retira a ball e o poke fica lá, com CDS 0.. da pra usar doRemoveCreature? alguma coisa assim? G.G
local focus = 0
local talk_start = 0
local conv = 0
local cost = 0
local pname = ""
local baseprice = 1
local pokePrice = {
["Bulbasaur"] = 3000,
["qwilfish"] = 10,
["Nidorina"] = 10,
["Nidorino"] = 10,
["Qwilfish"] = 10,
["Squirtle"] = 3000,
["Charmander"] = 3000, --PS: teve mais coisas mudadas entao.. peguem o script todo!
["Ivysaur"] = 4500, --alterado v1.6
["Venusaur"] = 12000,
}
function sellPokemon(cid, name, price)
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
if getPlayerSlotItem(cid, 8).uid ~= 0 then
if string.lower(getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")) == string.lower(name) then
if not getItemAttribute(getPlayerSlotItem(cid, 8).uid, "unique") then --alterado v1.6
selfSay("Wow! Thanks for this wonderful "..name.."! Take yours "..price.." dollars. Would you like to sell another pokemon?")
doRemoveItem(getPlayerSlotItem(cid, 8).uid, 1) --alterado v1.6
doPlayerAddMoney(cid, price * 100)
doTransformItem(getPlayerSlotItem(cid, CONST_SLOT_LEGS).uid, 2395)
return true
end
end
end
for a, b in pairs(pokeballs) do
local balls = getItemsInContainerById(bp.uid, b.on)
for _, ball in pairs (balls) do
if string.lower(getItemAttribute(ball, "poke")) == string.lower(name) then
if not getItemAttribute(ball, "unique") then --alterado v1.6
selfSay("Wow! Obrigado por este maravilhoso "..getItemAttribute(ball, "poke").."! Tome seus "..price.." dólares. Gostaria de vender mais pokemon?")
doRemoveItem(ball, 1)
doPlayerAddMoney(cid, price * 100)
return true
end
end
end
end
selfSay("Você não tem o "..name..", certifique-se que está na sua mochila e não desmaiou.") --alterado v1.6
return false
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if string.find(msg, "!") or string.find(msg, ",") then
return true
end
if focus == cid then
talk_start = os.clock()
end
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) <= 3 then
selfSay('Bem-vindo à minha loja! Eu compro pokemons de todas as espécies, apenas me diga o nome do Pokémon que você quer vender.')
focus = cid
conv = 1
talk_start = os.clock()
cost = 0
pname = ""
return true
end
if msgcontains(msg, 'bye') and focus == cid then
selfSay('Vejo você por aí, então!')
focus = 0
return true
end
if msgcontains(msg, 'yes') and focus == cid and conv == 4 then
selfSay('Diga-me o nome dos pokemon você gostaria de vender.')
conv = 1
return true
end
if msgcontains(msg, 'no') and conv == 4 and focus == cid then
selfSay('Ok, então nos vemos por aí!')
focus = 0
return true
end
local common = {"rattata", "caterpie", "weedle", "magikarp"}
if conv == 1 and focus == cid then
for a = 1, #common do
if msgcontains(msg, common[a]) then
selfSay('Eu não compro pokemon comuns!')
return true
end
end
end
if msgcontains(msg, 'no') and conv == 3 and focus == cid then
selfSay('Bem, então o que pokemon gostaria de vender?')
conv = 1
return true
end
if (conv == 1 or conv == 4) and focus == cid then
local name = doCorrectPokemonName(msg)
local pokemon = pokes[name]
if not pokemon then
selfSay("Desculpe, eu não sei o que pokemon que você está falando! Tem certeza de que soletrou corretamente?")
return true
end
baseprice = pokePrice[name] or math.floor(pokemon.level * 150) --alterado v1.6
cost = baseprice
pname = name
selfSay("Você gostaria de verde "..name.." por "..cost.." dólares?")
conv = 3
end
if isConfirmMsg(msg) and focus == cid and conv == 3 then
if sellPokemon(cid, pname, cost) then
conv = 4
else
conv = 1
end
return true
end
end
local intervalmin = 38
local intervalmax = 70
local delay = 25
local number = 1
local messages = {"Compro alguns pokemons bonitos! Venha aqui para vendê-los!",
"Quer vender um pokemon? Veio ao lugar certo!",
"Compro pokemon! Ofertas Excelente!",
"Cansado de um pokemon? Por que você não vendê-lo para mim?",
}
function onThink()
if focus == 0 then
selfTurn(1)
delay = delay - 0.5
if delay <= 0 then
selfSay(messages[number])
number = number + 1
if number > #messages then
number = 1
end
delay = math.random(intervalmin, intervalmax)
end
return true
else
if not isCreature(focus) then
focus = 0
return true
end
local npcpos = getThingPos(getThis())
local focpos = getThingPos(focus)
if npcpos.z ~= focpos.z then
focus = 0
return true
end
if (os.clock() - talk_start) > 70 then
focus = 0
selfSay("Eu tenho outros clientes também, se sente e espere a venda dele acabar.")
end
if getDistanceToCreature(focus) > 3 then
selfSay("Adeus então e obrigado!")
focus = 0
return true
end
local dir = doDirectPos(npcpos, focpos)
selfTurn(dir)
end
return true
end