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
- local storage = 5002
- function creatureSayCallback(cid, type, msg)
- if not npcHandler:isFocused(cid) then
- return false
- end
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- if msgcontains(msg, "mission") then
- if getPlayerStorageValue(cid, storage) == -1 then
- selfSay("I have a mission for you to kill 5 dragons and 3 dragon lords, do you accept?", cid)
- talkState[talkUser] = 1
- elseif getPlayerStorageValue(cid, storage) == 1 then
- selfSay("Did you kill 5 dragons and 3 dragon lords?", cid)
- talkState[talkUser] = 1
- else
- selfSay("You already did the mission.", cid)
- end
- elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
- if getPlayerStorageValue(cid, storage) == -1 then
- selfSay("Good, come back when you killed them.", cid)
- setPlayerStorageValue(cid, storage, 1)
- else
- if getPlayerStorageValue(cid, 19000) == 5 and getPlayerStorageValue(cid, 19001) == 3 then
- selfSay("Good job, here is your reward.", cid)
- doPlayerAddItem(cid, 2160, 5)
- doPlayerAddExp(cid, 50000)
- setPlayerStorageValue(cid, storage, 2)
- else
- selfSay("You didn't kill them all.", cid)
- end
- end
- talkState[talkUser] = 0
- elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
- selfSay("Ok then.", 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
Advertisement