O console está acusando a falta de um end para fechar a função onCreatureSayCallback. Verifique o script você mesmo, já que pedaços de script não irão me ajudar a consertar o erro.
info
Grupo: Conde
Registrado: 03/01/12
Posts: 884
Reputação: +233
Char no Tibia: Segredo

realmente a function não tinha o fim usa esse
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 oncreatureSayCallback(cid, type, msg)
local config = {
price = 50000,
delay = 5 * 60,
control = {10555, 10556}
}
if(not npcHandler:isFocused(cid)) then
return false
end
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
info
Grupo: Campones
Registrado: 19/02/08
Posts: 7
Reputação: 0
Char no Tibia: ADM Macumbeiro

@notle2012 não deu certo oq vc falou..
@Oneshot.. era só pedir tá? foi mal..
ta aki o script todo..
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
local config = {
price = 50000,
delay = 5 * 60,
control = {10555, 10556}
}
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
-- Conversa Jogador/NPC
if msgcontains(msg, "care") then
local p = (config.price % 1000 == 0 and (config.price / 1000) or config.price)
if getPlayerStorageValue(cid, config.control) > os.time() then
selfSay("Do you want me to take care of your egg for ".. p .." ".. (p == config.price and "" or "k") .."?", cid)
else
selfSay("Sorry, but I am already caring one of your eggs.", cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, "back") then
if getPlayerStorageValue(cid, config.control[2]) == 1 then
selfSay("Hello, do you came to pick up your egg?", cid)
talkState[talkUser] = 2
else
selfSay("Sorry, but I am not caring eggs from you.", cid)
end
elseif msgcontains(msg, "check") then
local t = getPlayerStorageValue(cid, config.control[1])
if getPlayerStorageValue(cid, config.control[2]) == -1 then
selfSay("Sorry, but I am not caring eggs from you.", cid)
else
if t < os.time() then
selfSay("Yay, your egg has started to hatch, take it.", cid)
setPlayerStorageValue(cid, config.control[1], -1)
setPlayerStorageValue(cid, config.control[2], -1)
else
selfSay("I will be caring your egg for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
end
end
end
-- Confirmação da Compra
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 12304, 1) == true) then
if doPlayerRemoveMoney(cid, config.price) then
setPlayerStorageValue(cid, config.control[1], os.time()+config.delay)
selfSay("Okay! Check back soon.", cid)
else
selfSay("Sorry, you don't have enough money. You need more ".. (config.price - getPlayerMoney(cid)) .." coins.", cid)
end
else
selfSay("I am already taking care of a egg for you.", cid)
end
elseif msgcontains(msg, "no") then
selfSay("Too pricey for you, heh?", cid)
end
elseif talkState[talkUser] == 2 then
local x = getPlayerStorageValue(cid, config.control)
local t = getPlayerStorageValue(cid, config.control[1])
if msgcontains(msg, "yes") then
if x > os.time() then
doPlayerAddItem(cid, 4850, 1)
doItemSetAttribute(item, "description", "A hatched egg.")
selfSay("Take it!", cid)
setPlayerStorageValue(cid, control[2], -1)
setPlayerStorageValue(cid, control[1], -1)
else
selfSay("Sorry, but your egg need care for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
será que é possivel consertar esse script? ..Dou Rep+
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
local config = {
price = 50000,
delay = 5 * 60,
control = {10555, 10556}
}
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
-- Conversa Jogador/NPC
if msgcontains(msg, "care") then
local p = (config.price % 1000 == 0 and (config.price / 1000) or config.price)
if getPlayerStorageValue(cid, config.control[1]) > os.time() then
selfSay("Do you want me to take care of your egg for ".. p .." ".. (p == config.price and "" or "k") .."?", cid)
else
selfSay("Sorry, but I am already caring one of your eggs.", cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, "back") then
if getPlayerStorageValue(cid, config.control[2]) == 1 then
selfSay("Hello, do you came to pick up your egg?", cid)
talkState[talkUser] = 2
else
selfSay("Sorry, but I am not caring eggs from you.", cid)
end
elseif msgcontains(msg, "check") then
local t = getPlayerStorageValue(cid, config.control[1])
if getPlayerStorageValue(cid, config.control[2]) == -1 then
selfSay("Sorry, but I am not caring eggs from you.", cid)
else
if t < os.time() then
selfSay("Yay, your egg has started to hatch, take it.", cid)
setPlayerStorageValue(cid, config.control[1], -1)
setPlayerStorageValue(cid, config.control[2], -1)
else
selfSay("I will be caring your egg for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
end
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, 12304, 1) == true) then
if doPlayerRemoveMoney(cid, config.price) then
setPlayerStorageValue(cid, config.control[1], os.time()+config.delay)
selfSay("Okay! Check back soon.", cid)
else
selfSay("Sorry, you don't have enough money. You need more ".. (config.price - getPlayerMoney(cid)) .." coins.", cid)
end
else
selfSay("I am already taking care of a egg for you.", cid)
end
elseif msgcontains(msg, "no") then
selfSay("Too pricey for you, heh?", cid)
elseif talkState[talkUser] == 2 then
local x = getPlayerStorageValue(cid, config.control)
local t = getPlayerStorageValue(cid, config.control[1])
if msgcontains(msg, "yes") then
if x > os.time() then
doPlayerAddItem(cid, 4850, 1)
doItemSetAttribute(item, "description", "A hatched egg.")
selfSay("Take it!", cid)
setPlayerStorageValue(cid, control[2], -1)
setPlayerStorageValue(cid, control[1], -1)
else
selfSay("Sorry, but your egg need care for more ".. (math.floor((t - os.time()) / 60) > 0 and "".. math.floor((t - os.time()) / 60) .." minutes and" or "") .." ".. (t - os.time()) % 60 .." seconds.", cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())




info
Grupo: Campones
Registrado: 19/02/08
Posts: 7
Reputação: 0
Char no Tibia: ADM Macumbeiro
Gente, está dando um error no meu console.. e eu queria ajuda pra conserta-lo
Pedaço do Script onde dá o Error:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 oncreatureSayCallback(cid, type, msg)
local config = {
price = 50000,
delay = 5 * 60,
control = {10555, 10556}
}
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
e aki o Error que dá no console :
[13/08/2012 13:53:37] [Error - LuaScriptInterface::loadFile] data/npc/scripts/eggsystem.lua:57: 'end' expected (to close 'function' at line 11) near 'elseif'
[13/08/2012 13:53:37] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/eggsystem.lua
[13/08/2012 13:53:37] data/npc/scripts/eggsystem.lua:57: 'end' expected (to close 'function' at line 11) near 'elseif'
Alguem pode me ajudar?