Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- if(not npcHandler:isFocused(cid)) then
- return false
- end
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- local markPos = {x = 0, y = 0, z = 7}
- local desc = "DESCRIPTION"
- if msgcontains(msg, 'hi') then
- selfSay('Olá, você quer marcar o seu mapa, fale {marcar} ou {nao}', cid)
- talkState[talkUser] = 2
- elseif msgcontains(msg, 'marcar') and talkState[talkUser] == 2 then
- selfSay('Pronto, mapa marcado', cid)
- doPlayerAddMapMark(cid, markPos, 4, desc)
- talkState[talkUser] = 0
- elseif msgcontains(msg, "nao") and talkState[talkUser] == 2 then
- selfSay('Ok, então.', cid)
- talkState[talkUser] = 0
- end
- return true
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment