• 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!

Help in this script!

skray

New Member
Joined
Oct 26, 2008
Messages
20
Reaction score
0
Location
Chile
hi this is a example of my script! and this give me error



PHP:
local keywordHandler = KeywordHandler:new()
        local npcHandler = NpcHandler:new(keywordHandler)
        NpcSystem.parseParameters(npcHandler)
 
 
 
 
        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)
 
            if (not npcHandler:isFocused(cid)) then
                return false
            end      
 
            if msgcontains(msg, 'thais') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32310, y=32209, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
 
            if msgcontains(msg, 'carlin') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32387, y=31820, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end
            
            if msgcontains(msg, 'ab\'dendriel) and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32734, y=31668, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'edron') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=33173, y=31764, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'venore') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32954, y=32022, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'port hope') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32527, y=32784, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'svargrond') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32341, y=31108, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'liberty bay') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32285, y=32892, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'yalahar') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32816, y=31272, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'oken') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=18165, y=17744, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'gengia') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=17508, y=17068, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'pyre') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=18781, y=18518, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    

            if msgcontains(msg, 'cormaya') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=33287, y=31955, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    

            if msgcontains(msg, 'kazordoon') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32659, y=31957, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    

            if msgcontains(msg, 'ankrahmun') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=33092, y=32883, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'darashia') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=33289, y=32481, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'farmine') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=33024, y=31550, z=10})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    
            
            if msgcontains(msg, 'goroma') and not isPlayerPzLocked(cid) then
                if doPlayerRemoveMoney(cid, 100) == true then
                    doTeleportThing(cid,{x=32161, y=32558, z=6})
                    self:releaseFocus(cid)                    
                else
                    npcHandler:say('You don\'t have enought money to travel!', cid) 
                    self:releaseFocus(cid)
                end
            end    

            if isPlayerPzLocked(cid) then
                    npcHandler:say('You can\'t travel, you have pz!', cid) 
            end
 
        return true
    end        
 
        npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
        keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to all places: {thais}, {carlin}.'})
 
        npcHandler:addModule(FocusModule:new())


THE ERROR:

PHP:
[4/12/2011 15:59:2] [Error - NpcScript Interface]
[4/12/2011 15:59:2] data/npc/scripts/viajar.luanCreatureSay
[4/12/2011 15:59:2] Description:
[4/12/2011 15:59:2] data/npc/scripts/viajar.lua:19: attempt to index global 'self' (a nil value)
[4/12/2011 15:59:2] stack traceback:
[4/12/2011 15:59:2] data/npc/scripts/viajar.lua:19: in function 'callback'
[4/12/2011 15:59:2] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[4/12/2011 15:59:2] data/npc/scripts/viajar.lua:7: in function <data/npc/scripts/viajar.lua:7>
 
PHP:
 if msgcontains(msg, 'ab\'dendriel) and not isPlayerPzLocked(cid) then 
                if doPlayerRemoveMoney(cid, 100) == true then 
                    doTeleportThing(cid,{x=32734, y=31668, z=6}) 
                    self:releaseFocus(cid)                     
                else 
                    npcHandler:say('You don\'t have enought money to travel!', cid)  
                    self:releaseFocus(cid) 
                end 
            end

The thing spot isnt missing the ' part?
 
Back
Top