Ir para conteúdo

[Encerrado] (Pedido) Pokemon Colletor


BrunooMaciell

Posts Recomendados

Galera preciso de uma ajuda ^^

 

meu pokemon colletor so tem 3 pokemons a venda quem puder mi manda um completo !!

 

Script

 

local focus = 0

local talk_start = 0

local conv = 0

local cost = 0

local pname = ""

local baseprice = 0

local pokePrice = {

["Bulbasaur"] = 3000,

["Ivysaur"] = 4500, --alterado v1.6

["Venusaur"] = 12000,

}

function sellPokemon(cid, name, price)

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

if #getCreatureSummons(cid) >= 1 then

selfSay("Back your pokemon to do that!")

focus = 0 --alterado v1.8

return true

end

local storages = {17000, 63215, 17001, 13008, 5700} --alterado v1.8

for s = 1, #storages do

if getPlayerStorageValue(cid, storages) >= 1 then

selfSay("You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")

focus = 0

return true

end

end

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! Thanks for this wonderful "..getItemAttribute(ball, "poke").."! Take yours "..price.." dollars. Would you like to sell another pokemon?")

doRemoveItem(ball, 1)

doPlayerAddMoney(cid, price * 100)

return true

end

end

end

end

selfSay("You don't have a "..name..", make sure it is in your backpack and it is not fainted and it is not in a Unique Ball!") --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('Welcome to my store! I buy pokemons of all species, just tell me the name of the pokemon you want to sell.')

focus = cid

conv = 1

talk_start = os.clock()

cost = 0

pname = ""

return true

end

if msgcontains(msg, 'bye') and focus == cid then

selfSay('See you around then!')

focus = 0

return true

end

if msgcontains(msg, 'yes') and focus == cid and conv == 4 then

selfSay('Tell me the name of the pokemon you would like to sell.')

conv = 1

return true

end

if msgcontains(msg, 'no') and conv == 4 and focus == cid then

selfSay('Ok, see you around then!')

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('I dont buy such a common pokemon!')

return true

end

end

end

if msgcontains(msg, 'no') and conv == 3 and focus == cid then

selfSay('Well, then what pokemon would you like to sell?')

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("Sorry, I don't know what pokemon you're talking about! Are you sure you spelled it correctly?")

return true

end

baseprice = pokePrice[name] or math.floor(pokemon.level * 150) --alterado v1.6

cost = baseprice

pname = name

selfSay("Are you sure you want to sell a "..name.." for "..cost.." dollars?")

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 = {"Buying some beautiful pokemons! Come here to sell them!",

"Wanna sell a pokemon? Came to the right place!",

"Buy pokemon! Excellent offers!",

"Tired of a pokemon? Why don't you sell it to me then?",

}

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("I have other clients too, talk to me when you feel like selling a pokemon.")

end

if getDistanceToCreature(focus) > 3 then

selfSay("Good bye then and thanks!")

focus = 0

return true

end

local dir = doDirectPos(npcpos, focpos)

selfTurn(dir)

end

 

return true

end

 

 

/\ como podem ver so tem 3 quem puder mi manda um completo ^^

 

 

Reps+++

Link para o comentário
Compartilhar em outros sites

Galera preciso de uma ajuda ^^

 

meu pokemon colletor so tem 3 pokemons a venda quem puder mi manda um completo !!

 

Script

 

local focus = 0

local talk_start = 0

local conv = 0

local cost = 0

local pname = ""

local baseprice = 0

local pokePrice = {

["Bulbasaur"] = 3000,

["Ivysaur"] = 4500, --alterado v1.6

["Venusaur"] = 12000,

}

function sellPokemon(cid, name, price)

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

if #getCreatureSummons(cid) >= 1 then

selfSay("Back your pokemon to do that!")

focus = 0 --alterado v1.8

return true

end

local storages = {17000, 63215, 17001, 13008, 5700} --alterado v1.8

for s = 1, #storages do

if getPlayerStorageValue(cid, storages) >= 1 then

selfSay("You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")

focus = 0

return true

end

end

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! Thanks for this wonderful "..getItemAttribute(ball, "poke").."! Take yours "..price.." dollars. Would you like to sell another pokemon?")

doRemoveItem(ball, 1)

doPlayerAddMoney(cid, price * 100)

return true

end

end

end

end

selfSay("You don't have a "..name..", make sure it is in your backpack and it is not fainted and it is not in a Unique Ball!") --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('Welcome to my store! I buy pokemons of all species, just tell me the name of the pokemon you want to sell.')

focus = cid

conv = 1

talk_start = os.clock()

cost = 0

pname = ""

return true

end

if msgcontains(msg, 'bye') and focus == cid then

selfSay('See you around then!')

focus = 0

return true

end

if msgcontains(msg, 'yes') and focus == cid and conv == 4 then

selfSay('Tell me the name of the pokemon you would like to sell.')

conv = 1

return true

end

if msgcontains(msg, 'no') and conv == 4 and focus == cid then

selfSay('Ok, see you around then!')

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('I dont buy such a common pokemon!')

return true

end

end

end

if msgcontains(msg, 'no') and conv == 3 and focus == cid then

selfSay('Well, then what pokemon would you like to sell?')

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("Sorry, I don't know what pokemon you're talking about! Are you sure you spelled it correctly?")

return true

end

baseprice = pokePrice[name] or math.floor(pokemon.level * 150) --alterado v1.6

cost = baseprice

pname = name

selfSay("Are you sure you want to sell a "..name.." for "..cost.." dollars?")

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 = {"Buying some beautiful pokemons! Come here to sell them!",

"Wanna sell a pokemon? Came to the right place!",

"Buy pokemon! Excellent offers!",

"Tired of a pokemon? Why don't you sell it to me then?",

}

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("I have other clients too, talk to me when you feel like selling a pokemon.")

end

if getDistanceToCreature(focus) > 3 then

selfSay("Good bye then and thanks!")

focus = 0

return true

end

local dir = doDirectPos(npcpos, focpos)

selfTurn(dir)

end

 

return true

end

 

 

/\ como podem ver so tem 3 quem puder mi manda um completo ^^

 

 

Reps+++

 

Não vou te mandar um completo pois não tenho, mas se você quiser adicionar e for o caso de você não saber.

 

Não vi o script todo mas acredito que é só você colocar aqui...

 

local pokePrice = {

["Bulbasaur"] = 3000,

["Ivysaur"] = 4500,

["Venusaur"] = 12000,

["pokemonnovo1"] = XXX, (pokemonnovo1 = nome do pokemon / XXX = preço)

["pokemonnovo2"] = XXX,

["pokemonnovo3"] = XXX,

["pokemonnovo4"] = XXX,

}

 

e aqui você pode colocar pokémons comuns que você não quer que ele compre...

 

local common = {"rattata", "caterpie", "weedle", "magikarp","pokemoncomum1","pokemoncomum2"}

Editado por CabritenhO
Link para o comentário
Compartilhar em outros sites

Brunnoo.

Aqui esta o seu script completo:

 

 

 

local focus = 0

local talk_start = 0

local conv = 0

local cost = 0

local pname = ""

local baseprice = 0

local pokePrice = {

["Bulbasaur"] = 3000,

["Ivysaur"] = 4500,

["Venusaur"] = 6000,

["Charmander"] = 3000,

["Charmeleon"] = 4500,

["Charizard"] = 6000,

["Squirtle"] = 3000,

["Wartortle"] = 4500,

["Blastoise"] = 6000,

["Caterpie"] = 300,

["Metapod"] = 450,

["Butterfree"] = 600,

["Weedle"] = 200,

["Kakuna"] = 250,

["Beedrill"] = 1200,

["Pidgey"] = 1200,

["Pidgeotto"] = 1200,

["Pidgeot"] = 1200,

["Rattata"] = 120,

["Raticate"] = 300,

["Spearow"] = 120,

["Fearow"] = 1201,

["Ekans"] = 120,

["Arbok"] = 1201,

["Pikachu"] = 350,

["Raichu"] = 1201,

["Sandshrew"] = 1201,

["Sandslash"] = 120,

["Nidoran Female"] = 1201,

["Nidorina"] = 121,

["Nidoqueen"] = 1201,

["Nidoran Male"] = 120,

["Nidorino"] = 120,

["Nidoking"] = 1202,

["Clefairy"] = 1202,

["Clefable"] = 1202,

["Vulpix"] = 120,

["Ninetales"] = 1202,

["Jigglypuff"] = 1202,

["Wigglytuff"] = 1202,

["Zubat"] = 1202,

["Golbat"] = 123,

["Oddish"] = 120,

["Gloom"] = 120,

["Vileplume"] = 1203,

["Paras"] = 1203,

["Parasect"] = 1203,

["Venonat"] = 1203,

["Venomoth"] = 1207,

["Diglett"] = 120,

["Dugtrio"] = 1203,

["Meowth"] = 1204,

["Persian"] = 1201,

["Psyduck"] = 1202,

["Golduck"] = 1203,

["Mankey"] = 1204,

["Primeape"] = 1245,

["Growlithe"] = 1046,

["Arcanine"] = 1247,

["Poliwag"] = 1208,

["Poliwhirl"] = 1049,

["Poliwrath"] = 1250,

["Abra"] = 1251,

["Kadabra"] = 1252,

["Alakazam"] = 1053,

["Machop"] = 1254,

["Machoke"] = 1255,

["Machamp"] = 1206,

["Bellsprout"] = 1207,

["Weepinbell"] = 1208,

["Victreebel"] = 1259,

["Tentacool"] = 1200,

["Tentacruel"] = 1201,

["Geodude"] = 1202,

["Graveler"] = 1203,

["Golem"] = 1204,

["Ponyta"] = 1205,

["Rapidash"] = 1266,

["Slowpoke"] = 1267,

["Slowbro"] = 1206,

["Magnemite"] = 1209,

["Magneton"] = 1200,

["Farfetch'd"] = 1271,

["Doduo"] = 1272,

["Dodrio"] = 1273,

["Seel"] = 1204,

["Dewgong"] = 1205,

["Grimer"] = 1276,

["Muk"] = 1277,

["Shellder"] = 1208,

["Cloyster"] = 1279,

["Gastly"] = 1280,

["Haunter"] = 1281,

["Gengar"] = 1208,

["Onix"] = 1203,

["Drowzee"] = 1284,

["Hypno"] = 12085,

["Krabby"] = 1206,

["Kingler"] = 1207,

["Voltorb"] = 1208,

["Electrode"] = 1089,

["Exeggcute"] = 1290,

["Exeggutor"] = 1291,

["Cubone"] = 1209,

["Marowak"] = 1209,

["Hitmonlee"] = 1294,

["Hitmonchan"] = 1095,

["Lickitung"] = 1296,

["Koffing"] = 1207,

["Weezing"] = 1208,

["Rhyhorn"] = 1209,

["Rhydon"] = 1210,

["Chansey"] = 1211,

["Tangela"] = 1212,

["Kangaskhan"] = 1103,

["Horsea"] = 1214,

["Seadra"] = 1215,

["Goldeen"] = 2106,

["Seaking"] = 12107,

["Staryu"] = 1208,

["Starmie"] = 1109,

["Mr. Mime"] = 1110,

["Scyther"] = 12211,

["Jynx"] = 12112,

["Electabuzz"] = 12113,

["Magmar"] = 80002,

["Pinsir"] = 12115,

["Tauros"] = 12116,

["Magikarp"] = 12117,

["Gyarados"] = 12118,

["Lapras"] = 12119,

["Ditto"] = 12120,

["Eevee"] = 12121,

["Vaporeon"] = 12122,

["Jolteon"] = 12123,

["Flareon"] = 12124,

["Porygon"] = 12125,

["Omanyte"] = 12126,

["Omastar"] = 12127,

["Kabuto"] = 12128,

["Kabutops"] = 12129,

["Aerodactyl"] = 12130,

["Snorlax"] = 12131,

["Articuno"] = 12132,

["Zapdos"] = 12133,

["Moltres"] = 12134,

["Dratini"] = 12135,

["Dragonair"] = 12136,

["Dragonite"] = 12137,

["Mewtwo"] = 12138,

["Mew"] = 12139,

["Shiny Venusaur"] = 111390,

["Shiny Charizard"] = 111402,

["Shiny Blastoise"] = 111405,

["Shiny Butterfree"] = 110148,

["Shiny Beedrill"] = 111501,

["Shiny Pidgeot"] = 111504,

["Shiny Rattata"] = 111505,

["Shiny Raticate"] = 111506,

["Shiny Fearow"] = 111508,

["Shiny Raichu"] = 111062,

["Shiny Nidoking"] = 111070,

["Shiny Zubat"] = 111707,

["Shiny Golbat"] = 111078,

["Shiny Oddish"] = 111079,

["Shiny Vileplume"] = 110181,

["Shiny Paras"] = 111802,

["Shiny Parasect"] = 111083,

["Shiny Venonat"] = 111084,

["Shiny Venomoth"] = 111085,

["Shiny Growlithe"] = 110194,

["Shiny Arcanine"] = 111095,

["Shiny Abra"] = 111099,

["Shiny Alakazam"] = 110001,

["Shiny Tentacool"] = 112008,

["Shiny Tentacruel"] = 112009,

["Shiny Golem"] = 112102,

["Shiny Farfetch'd"] = 112109,

["Shiny Grimer"] = 112204,

["Shiny Muk"] = 112025,

["Shiny Gengar"] = 112030,

["Shiny Onix"] = 125078,

["Shiny Hypno"] = 112303,

["Shiny Krabby"] = 112034,

["Shiny Kingler"] = 112035,

["Shiny Voltorb"] = 112306,

["Shiny Electrode"] = 112037,

["Shiny Cubone"] = 112400,

["Shiny Marowak"] = 112401,

["Shiny Hitmonlee"] = 112042,

["Shiny Hitmonchan"] = 112043,

["Shiny Hitmontop"] = 125077,

["Shiny Tangela"] = 112500,

["Shiny Horsea"] = 112502,

["Shiny Seadra"] = 112053,

["Shiny Scyther"] = 110259,

["Shiny Jynx"] = 112060,

["Shiny Electabuzz"] = 112061,

["Shiny Pinsir"] = 112603,

["Shiny Magikarp"] = 112605,

["Shiny Gyarados"] = 112066,

["Shiny Ditto"] = 112068,

["Shiny Vaporeon"] = 112070,

["Shiny Jolteon"] = 112071,

["Shiny Flareon"] = 112072,

["Shiny Snorlax"] = 112079,

["Shiny Dratini"] = 112083,

["Shiny Dragonair"] = 112084,

["Shiny Dragonite"] = 112805,

["Chikorita"] = 1128,

["Bayleef"] = 1128,

["Meganium"] = 1120,

["Cyndaquil"] = 1191,

["Quilava"] = 1192,

["Typhlosion"] = 1293,

["Totodile"] = 1124,

["Croconaw"] = 1195,

["Feraligatr"] = 1196,

["Sentret"] = 1197,

["Furret"] = 1198,

["Hoothoot"] = 1199,

["Noctowl"] = 1100,

["Ledyba"] = 1131,

["Ledian"] = 1102,

["Spinarak"] = 1303,

["Ariados"] = 1104,

["Crobat"] = 1105,

["Chinchou"] = 1136,

["Lanturn"] = 1137,

["Pichu"] = 1130,

["Cleffa"] = 1139,

["Igglybuff"] = 1130,

["Togepi"] = 1111,

["Togetic"] = 1132,

["Natu"] = 1133,

["Xatu"] = 1134,

["Mareep"] = 1115,

["Flaaffy"] = 1116,

["Ampharos"] = 1117,

["Bellossom"] = 1118,

["Marill"] = 1131,

["Azumarill"] = 1120,

["Sudowoodo"] = 1131,

["Politoed"] = 1122,

["Hoppip"] = 1123,

["Skiploom"] = 1134,

["Jumpluff"] = 1125,

["Aipom"] = 1136,

["Sunkern"] = 1137,

["Sunflora"] = 1328,

["Yanma"] = 1129,

["Wooper"] = 1130,

["Quagsire"] = 1331,

["Espeon"] = 1132,

["Umbreon"] = 113,

["Murkrow"] = 1134,

["Slowking"] = 113,

["Misdreavus"] = 11336,

["Unown"] = 1137,

["Wobbuffet"] = 1138,

["Girafarig"] = 1139,

["Pineco"] = 1130,

["Forretress"] = 1141,

["Dunsparce"] = 1142,

["Gligar"] = 1133,

["Steelix"] = 1134,

["Snubbull"] = 1345,

["Granbull"] = 1146,

["Qwilfish"] = 1347,

["Scizor"] = 1148,

["Shuckle"] = 1139,

["Heracross"] = 1350,

["Sneasel"] = 1151,

["Teddiursa"] = 1152,

["Ursaring"] = 1133,

["Slugma"] = 1134,

["Magcargo"] = 1355,

["Swinub"] = 1156,

["Piloswine"] = 1357,

["Corsola"] = 1138,

["Remoraid"] = 1159,

["Octillery"] = 1360,

["Delibird"] = 1161,

["Mantine"] = 11362,

["Skarmory"] = 11363,

["Houndour"] = 11364,

["Houndoom"] = 11365,

["Kingdra"] = 11366,

["Phanpy"] = 11367,

["Donphan"] = 11368,

["Porygon2"] = 11369,

["Stantler"] = 11370,

["Smeargle"] = 11371,

["Tyrogue"] = 11372,

["Hitmontop"] = 11373,

["Smoochum"] = 11374,

["Elekid"] = 11375,

["Magby"] = 11376,

["Miltank"] = 11377,

["Blissey"] = 11378,

["Raikou"] = 11379,

["Entei"] = 11380,

["Suicune"] = 11381,

["Larvitar"] = 11382,

["Pupitar"] = 11383,

["Tyranitar"] = 11384,

["Lugia"] = 1138005,

["Ho-oh"] = 2000006,

["Celebi"] = 113870000} ,

}

function sellPokemon(cid, name, price)

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

if #getCreatureSummons(cid) >= 1 then

selfSay("Back your pokemon to do that!")

focus = 0 --alterado v1.8

return true

end

local storages = {17000, 63215, 17001, 13008, 5700} --alterado v1.8

for s = 1, #storages do

if getPlayerStorageValue(cid, storages) >= 1 then

selfSay("You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")

focus = 0

return true

end

end

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! Thanks for this wonderful "..getItemAttribute(ball, "poke").."! Take yours "..price.." dollars. Would you like to sell another pokemon?")

doRemoveItem(ball, 1)

doPlayerAddMoney(cid, price * 100)

return true

end

end

end

end

selfSay("You don't have a "..name..", make sure it is in your backpack and it is not fainted and it is not in a Unique Ball!") --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('Welcome to my store! I buy pokemons of all species, just tell me the name of the pokemon you want to sell.')

focus = cid

conv = 1

talk_start = os.clock()

cost = 0

pname = ""

return true

end

if msgcontains(msg, 'bye') and focus == cid then

selfSay('See you around then!')

focus = 0

return true

end

if msgcontains(msg, 'yes') and focus == cid and conv == 4 then

selfSay('Tell me the name of the pokemon you would like to sell.')

conv = 1

return true

end

if msgcontains(msg, 'no') and conv == 4 and focus == cid then

selfSay('Ok, see you around then!')

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('I dont buy such a common pokemon!')

return true

end

end

end

if msgcontains(msg, 'no') and conv == 3 and focus == cid then

selfSay('Well, then what pokemon would you like to sell?')

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("Sorry, I don't know what pokemon you're talking about! Are you sure you spelled it correctly?")

return true

end

baseprice = pokePrice[name] or math.floor(pokemon.level * 150) --alterado v1.6

cost = baseprice

pname = name

selfSay("Are you sure you want to sell a "..name.." for "..cost.." dollars?")

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 = {"Buying some beautiful pokemons! Come here to sell them!",

"Wanna sell a pokemon? Came to the right place!",

"Buy pokemon! Excellent offers!",

"Tired of a pokemon? Why don't you sell it to me then?",

}

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("I have other clients too, talk to me when you feel like selling a pokemon.")

end

if getDistanceToCreature(focus) > 3 then

selfSay("Good bye then and thanks!")

focus = 0

return true

end

local dir = doDirectPos(npcpos, focpos)

selfTurn(dir)

end

 

return true

end

 

 

Editado por DinoAdmin
Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...