Olá.
Estou Com um problema com meu NPC de Dar Apelidos Aos Pokes, o erro é o seguinte.
[18/10/2011 12:09:41] [Error - LuaScriptInterface::loadFile] data/npc/scripts/nick.lua:49: 'end' expected (to close 'function' at line 30) near 'elseif'[18/10/2011 12:09:41] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/nick.lua
[18/10/2011 12:09:41] data/npc/scripts/nick.lua:49: 'end' expected (to close 'function' at line 30) near 'elseif'
Na hora que eu tento invocar ele no meu server da esse erro a cima /\.
Como Faço Pra Arrumar.
Se Alguem Precisar do script do npc vai ai.
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local talkState = {}
local finalname = ""
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye sir!')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msge)
local msg = string.lower(msge)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if (msgcontains(msg, "hi") and (focus == 0) and (focus ~= cid) and (getDistanceToCreature(cid) <= 4)) then
--if not isPremium(cid) then
--if isBr(cid) then
--selfSay("Olá, "..getCreatureName(cid).."! Me desculpe, mas o serviço de apelidos é privilégio de jogadores premium!")
--else
--selfSay("Hello, "..getCreatureName(cid).."! I'm sorry, but I can only give nicknames to pokemons for premium members!")
--end
--return true
--end
focus = cid
talkState[talkUser] = 1
selfSay("Olá, "..getCreatureName(cid).."! Eu posso apelidar seu pokemon, você aceita?")
else
selfSay("Hello, "..getCreatureName(cid).."! I can give your pokemon a nickname, would you like it?")
end
elseif (msgcontains(msg, "no") or msgcontains(msg, "bye")) and focus == cid and talkState[talkUser] ~= 3 then
if isBr(cid) then
selfSay("Sem problemas, senhor. Volte assim que desejar!")
else
selfSay("No problem then, sir. Come back when you feel like it!")
end
focus = 0
elseif msgcontains(msg, "yes") and focus == cid and talkState[talkUser] == 1 then
if not isInArray({2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216,
2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2227}, getPlayerSlotItem(cid, 8).itemid) then
if isBr(cid) then
selfSay("Desculpe, mas você não tem um pokemon no lugar correto!")
else
selfSay("Sorry, you don't have a pokemon in the main slot!")
end
focus = 0
return true
end
if not isBr(cid) then
selfSay("What nickname would you like me to give to your pokemon?")
else
selfSay("Qual apelido deseja colocar em seu pokemon?")
end
talkState[talkUser] = 3
elseif talkState[talkUser] == 3 and focus == cid then
local tablee = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "w", "y", "z", ".", ":", "'", '"', "~", "^", "@", "#", "$", "%", "&", "*", "(", ")", "-", "+", "_", "?", ">", "<", "•", ";", "°", "¹", "²", "³", "£", "¢", "¬", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
local table = {"'", '"', "!", "ã", "õ", "ç", "´", "`", "á", "à", "ó", "ò", "é", "è", "í", "ì", "ú", "ù", "¹", "²", "³", "£", "¢", "¬", "§", "°", "º", "ª", "•", "|"}
for a = 1, #table do
if string.find(msg, table[a]) then
if not isBr(cid) then
selfSay("Sorry, the nick has invalid symbols.")
else
selfSay("Desculpe, mas há letras não permitidas.")
end
return true
end
end
if string.len(msg) <= 1 or string.len(msg) >= 19 then
if isBr(cid) then
selfSay("Desculpe, esse nick é grande ou pequeno demais!")
else
selfSay("Sorry, that nick is too long or too short!")
end
return true
end
local pokename = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
if isBr(cid) then
selfSay("Tem certeza que deseja apelidar seu "..pokename.." como \""..msge.."\"? Isso irá custar 1000 dólares.")
else
selfSay("Are you sure that you want to change your's "..pokename.." name to \""..msge.."\"? This is going to cost you 10 hundred dollars.")
end
talkState[talkUser] = 5
finalname = msge
elseif msgcontains(msg, "yes") and focus == cid and talkState[talkUser] == 5 then
if doPlayerRemoveMoney(cid, 100000) == false then
if isBr(cid) then
selfSay("Você não tem dinheiro suficiente para me pagar, volte mais tarde.")
else
selfSay("You don't have enough money to afford this service, come back later.")
end
focus = 0
talkState[talkUser] = 0
return true
end
local newarch = ""..finalname..""
if isBr(cid) then
selfSay("Feito! Seu pokemon agora tem um apelido, aproveite!")
else
selfSay("Done! Your pokemon now has a new name, enjoy it!")
end
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "nick", newarch)
local newdes = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "fakedesc").."\nIt's nickname is: "..finalname.."."
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "description", newdes)
doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "nname", finalname)
if #getCreatureSummons(cid) >= 1 then
doCreatureSetNick(getCreatureSummons(cid)[1], finalname)
end
focus = 0
talkState[talkUser] = 0
end
end
function onThink()
if focus ~= 0 then
a, b, c = selfGetPosition()
if c ~= getThingPos(focus).z then
focus = 0
end
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 6 then
focus = 0
end
end
return true
end
o Server que eu uso é o PField Project = Pokemon Dash
Obrigado Pela Atenção de Vc's.
Lembrando: Quem Ajudar Ganhar 3 Semanas De REP +



