JE
dúvida

Problema com NPC (mysql)

Por jeff of hell, 10 de mai. de 2013 em Scripts

npc
resolvido
script
11
1.7k
jeff of hellJ
10 de maio de 2013 às 19:10

Bom, sei que devem ter achado o titulo estranho, mas eu estou com um problema.

 

 

Coloquei site no meu server de pokemon e depois q mudei para mysql o npc Pokemon Collector não carrega. Sou meio leigo quanto a databases e não sei "pelo quê" procurar no fórum quanto a isto.

 

o erro é o seguinte:

[10/05/2013 17:43:23] [Error - LuaScriptInterface::loadFile] data/npc/scripts/pokemon seller.lua:1: unexpected symbol near 'ï'

[10/05/2013 17:43:23] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/pokemon seller.lua

[10/05/2013 17:43:23] data/npc/scripts/pokemon seller.lua:1: unexpected symbol near 'ï'

 

enfim, se alguém puder me ajudar eu ficaria agradecido.

dou REP+

desde já, obrigado.

RoksasR
10 de maio de 2013 às 19:46

Posta o código do npc aqui por favor, chama pokemonseller.lua, fica em data/npc/scripts

jeff of hellJ
10 de maio de 2013 às 21:25

Então cara, o npc roda em servidor normal, deu isso depois do mysql. o npc não foi editado nem nada. coloquei um novo direto do down original e apresenta o mesmo erro. isso me leva a crer q não é nele. porem, tudo é possível. ta ai o código dele:

 

local focus = 0

local talk_start = 0

local conv = 0

local cost = 0

local pname = ""

local baseprice = 0

 

local pokePrice = {

["Bulbasaur"] = 3000,

["Ivysaur"] = 8000,

["Venusaur"] = 18000,

["Charmander"] = 3000,

["Charmeleon"] = 8000,

["Charizard"] = 18000,

["Squirtle"] = 3000,

["Wartortle"] = 8000,

["Blastoise"] = 18000,

["Caterpie"] = 5,

["Metapod"] = 250,

["Butterfree"] = 2000,

["Weedle"] = 5,

["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"] = 6000,

["nidoranfe"] = 125,

["Nidorina"] = 2250,

["Nidoqueen"] = 12250,

["niroranma"] = 125,

["Nidorino"] = 2250,

["Nidoking"] = 12250,

["Clefairy"] = 8000,

["Clefable"] = 18000,

["Vulpix"] = 1000,

["Ninetales"] = 8500,

["Jigglypuff"] = 8000,

["Wigglytuff"] = 18000,

["Zubat"] = 300,

["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"] = 13500,

["Poliwag"] = 80,

["Poliwhirl"] = 3000,

["Poliwrath"] = 13000,

["Abra"] = 800,

["Kadabra"] = 5800,

["Alakazam"] = 15800,

["Machop"] = 2000,

["Machoke"] = 7000,

["Machamp"] = 17000,

["Bellsprout"] = 80,

["Weepinbell"] = 2250,

["Victreebel"] = 12000,

["Tentacool"] = 300,

["Tentacruel"] = 10000,

["Geodude"] = 300,

["Graveler"] = 5000,

["Golem"] = 15000,

["Ponyta"] = 1500,

["Rapidash"] = 6500,

["Slowpoke"] = 400,

["Slowbro"] = 5400,

["Magnemite"] = 400,

["Magneton"] = 5400,

["Farfetch'd"] = 10000,

["Doduo"] = 600,

["Dodrio"] = 5600,

["Seel"] = 2000,

["Dewgong"] = 12000,

["Grimer"] = 300,

["Muk"] = 3000,

["Shellder"] = 200,

["Cloyster"] = 10200,

["Gastly"] = 3000,

["Haunter"] = 8000,

["Gengar"] = 18000,

["Onix"] = 6000,

["Drowzee"] = 1000,

["Hypno"] = 6000,

["Krabby"] = 200,

["Kingler"] = 5200,

["Voltorb"] = 250,

["Electrode"] = 3000,

["Exeggcute"] = 200,

["Exeggutor"] = 10000,

["Cubone"] = 1000,

["Marowak"] = 11000,

["Hitmonlee"] = 500000,

["Hitmonchan"] = 500000,

["Lickitung"] = 60000,

["Koffing"] = 300,

["Weezing"] = 3000,

["Rhyhorn"] = 3000,

["Rhydon"] = 13000,

["Chansey"] = 40000,

["Tangela"] = 10000,

["Kangaskhan"] = 120000,

["Horsea"] = 200,

["Seadra"] = 8000,

["Goldeen"] = 200,

["Seaking"] = 3000,

["Staryu"] = 400,

["Starmie"] = 3000,

["Mr. Mime"] = 40000,

["Scyther"] = 120000,

["Jynx"] = 120000,

["Electabuzz"] = 120000,

["Magmar"] = 120000,

["Pinsir"] = 9000,

["Tauros"] = 5000,

["Magikarp"] = 5,

["Gyarados"] = 55000,

["Lapras"] = 120000,

["Ditto"] = 70000,

["Eevee"] = 45000,

["Vaporeon"] = 50000,

["Jolteon"] = 50000,

["Flareon"] = 50000,

["Porygon"] = 60000,

["Omanyte"] = 20000,

["Omastar"] = 75000,

["Kabuto"] = 20000,

["Kabutops"] = 75000,

["Aerodactyl"] = 2000000,

["Snorlax"] = 200000,

["Dratini"] = 15000,

["Dragonair"] = 65000,

["Dragonite"] = 125000,

}

 

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! 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 = {}

 

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

tiuguedorT
11 de maio de 2013 às 00:17

ese erro ai ocorre quando vc vai no editor e ponha ele no spaw?

jeff of hellJ
11 de maio de 2013 às 08:38

Negativo, este erro ocorre quando eu ligo o servidor e ele está carregando os scripts.

KratosTheBestK
11 de maio de 2013 às 22:13

ese erro ai ocorre quando vc vai no editor e ponha ele no spaw?

Esse erro ocorre quando o servidor tenta executar o npc, seja na hora de abrir ou há qualquer momento em que você tente coloca-lo no mapa.

O mesmo erro ocorre no meu servidor, e foi quando eu passei ele pra MySql, quem conseguir ajudar tambem dou rep+

KarlKalvinK
12 de maio de 2013 às 05:25

Carai acontecia isso no meu OTServ, eu resolvia sabe como ?!..

Eu copiava tudo que tem dentro do arquivo, deletava o arquivo, criava um novo bloco de notas colava ali dentro e ai salvava.. e reiniciava o ot ficava normalmente.

KratosTheBestK
12 de maio de 2013 às 21:13

Será que precisa adicionar alguma função da database MySql?

KarlKalvinK
13 de maio de 2013 às 20:15

Não, nada haver, faz oque eu falei que resolve.. isso é alguns bug que o distro da as vezes, malucão de PDA.

jeff of hellJ
16 de maio de 2013 às 08:38

Erro concertado.

 

Pelo que vi, o database mysql não tinha uma tabela que este npc precisava para rodar. a solução foi fazer a adição da tabela.

RoksasR
18 de maio de 2013 às 16:51

Tópico movido para a seção de dúvidas e pedidos resolvidos.