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

Something is wrong.

ruth

Veteran OT User
Joined
Aug 3, 2009
Messages
670
Solutions
2
Reaction score
380
Console engine say's something is wrong 'near then' but i dont know number of line.

Code:
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
 
npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. What do you need?")
 
function greetCallback(cid)
        -- Resetting talkState[talkUser]
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
        talkState[talkUser] = 0
    return true
end
 
function creatureSayCallback (cid, type, msg)
 
        if(npcHandler.focus ~= cid) then
                return false
        end
 
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
        if(msgcontains(msg, 'box') or msgcontains(msg, 'present box')) then
            npcHandler:say("Do you have a suitable present box for me?",cid)
            talkState[talkUser] = 1
        elseif(msgcontains(msg, "yes") and talkState[talkUser] == 1) then
            if doPlayerRemoveItem(cid,1990,1) == TRUE then 
                doPlayerAddItem(cid,2480,1)
                npcHandler:say("THANK YOU! Here is a helmet that will serve you well.",cid)
			end		
        elseif(msgcontains(msg, 'key') then
            npcHandler:say("Do you want to buy the Key to Adventure for 5 gold coins?",cid)
            talkState[talkUser] = 2
        elseif(msgcontains(msg, "yes") and talkState[talkUser] == 2) then
            if doPlayerRemoveMoney(cid, 5) == TRUE then
                key = doPlayerAddItem(cid,2088,1)
                doSetItemActionId(key, 4600)
                talkState[talkUser] = 0
            else
                npcHandler:say("HEY! You dont have one! Stop playing tricks on me or I will give some extra work.", cid)
                talkState[talkUser] = 0
            end
        elseif(talkState[talkUser] == 1) then
                npcHandler:say("Only nonsense on your mind, eh?", cid)
                talkState[talkUser] = 0
        end
end
 
Back
Top