• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

What is Wrong?

Yony

New Member
Joined
Sep 7, 2007
Messages
318
Reaction score
0
Location
Israel
what is wrong with this script?


PHP:
local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 

-- OTServ event handling functions start 
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 

-- OTServ event handling functions end 

    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.  
  local telePos = {x = 860, y = 320, z = 7} --change   
    if msgcontains(msg, 'yes') then 
            doTeleportThing(cid,telePos) 
    end  
   return true 
end 

npcHandler:addModule(FocusModule:new())

I get this error:
'<eof>' expected near 'end'
 
You have got this error because you missed the function but you added the 'end' of that missing function. Try this:

Code:
local keywordHandler = KeywordHandler:new() 
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler) 

-- OTServ event handling functions start 
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 

-- OTServ event handling functions end 

    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.  

[COLOR="Red"]function creatureSayCallback(cid, type, msg)[/COLOR]
  local telePos = {x = 860, y = 320, z = 7} --change   
    if msgcontains(msg, 'yes') then 
            doTeleportThing(cid,telePos) 
    end  
   return true 
end 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Regards.
 
Back
Top