Advertisement
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 destination = {x = 359, y = 1667, z = 7}
- if msgcontains(msg, 'hi') then
- if getPlayerLevel(cid) > 170 then
- selfSay('Olá, você quer ir para a rocket quest, fale {rocket}', cid)
- talkState[talkUser] = 2
- else
- selfSay('Desculpe, mas somente players com level maior que 170 podem ir para lá', cid)
- talkState[talkUser] = 0
- end
- elseif msgcontains(msg, 'rocket') and talkState[talkUser] == 2 then
- selfSay('Boa viagem', cid)
- doTeleportThing(cid, destination)
- 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
Advertisement