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 = {}
- local pirate = tasks["pirate ghost"]
- local questStatus = 72586
- 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, "task") and getPlayerStorageValue(cid, questStatus) == 4) then
- selfSay('Fuck yeah!', cid)
- end
- if (msgcontains(msg, "task") and getPlayerStorageValue(cid, pirate.storage) == -1) then
- selfSay("The pirates on Nargor are becoming more and more of a threat to us each day. I wish someone could get rid of them once and for all, but unfortunately they just keep coming!", cid)
- selfSay("Only a dead pirate is a good pirate. I think killing a large number of them would definitely help us to make Sabrehaven a safer place...", cid)
- selfSay("It doesn't matter how long it takes, but... would you be willing to kill 3000 pirates for us?", cid)
- talkState[cid] = 1
- print("Estou aqui -> 01")
- elseif msgcontains(msg, "task") and getPlayerStorageValue(cid, pirate.storage) == pirate.amount and getPlayerStorageValue(cid, 14105) == -1 then
- selfSay("Hey, great. You've done well! As a small reward I give you some coins from our treasure box. Also, let me tell you an interesting piece of information...", cid)
- selfSay("One our of spies told us about a secret hideout somewhere on Nargor. Supposedly, one of the four pirate leaders can be found there sometimes. If you dare go there, you might be able to face him or her in one on one combat...", cid)
- selfSay("Beware though - prepare yourself well and only flee if you must. This might be your only chance to get into there, so be careful and don't die!", cid)
- if getPlayerStorageValue(cid, questStatus) == -1 then
- setPlayerStorageValue(cid, questStatus, 1)
- else
- setPlayerStorageValue(cid, questStatus, getPlayerStorageValue(cid, questStatus) + 1)
- end
- setPlayerStorageValue(cid, 14105, 1) --storage necessário para entrar na sala dos pirates em Nargor.
- talkState[cid] = 0
- print("Estou aqui -> 02")
- elseif msgcontains(msg, "task") and getPlayerStorageValue(cid, 14105) == 2 then
- setPlayerStorageValue(cid, pirate.storage, 3001) --Define [Completed] no QuestLog.
- if getPlayerStorageValue(cid, questStatus) < 3 then
- selfSay("So you went into the leaders' hideout? I hope you were successful and got what you were looking for! Thank you, my friend. Pirates still keep coming here, unfortunately", cid)
- selfSay("Do you, by chance, would like to kill pirates again for us?", cid)
- talkState[cid] = 2
- else
- selfSay('Ahh, thank you, my friend! What would we do without you? Here, take this reward for your efforts. If you want to continue to help us killing pirates, just ask me about that {task}.', cid)
- setPlayerStorageValue(cid, questStatus, 4)
- setPlayerStorageValue(cid, 14105, -1)
- talkState[cid] = 0
- end
- print("Estou aqui -> 03")
- elseif (msgcontains(msg, "yes") and talkState[cid] == 1) then
- selfSay("Perfect. I know it sounds a lot, but really, take your time. You won't do it for nothing, I promise.", cid)
- if getPlayerStorageValue(cid, 14503) < 1 then --Habilitar o questLog.
- setPlayerStorageValue(cid, 14503, 1)
- setPlayerStorageValue(cid, 14501, 0)
- end
- setPlayerStorageValue(cid, 13500, pirate.storage)
- setPlayerStorageValue(cid, pirate.storage, 0)
- setPlayerStorageValue(cid, 14105, -1)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Your questlog has been updated.")
- doPlayerSendTutorial(cid, 3)
- print("Return do Estou aqui -> 01")
- talkState[cid] = 0
- elseif (msgcontains(msg, "yes") and talkState[cid] == 2) then
- selfSay("Perfect. I know it sounds a lot, but really, take your time. You won't do it for nothing, I promise.", cid)
- setPlayerStorageValue(cid, 13500, pirate.storage)
- setPlayerStorageValue(cid, pirate.storage, 0)
- setPlayerStorageValue(cid, 14105, -1)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Your questlog has been updated.")
- doPlayerSendTutorial(cid, 3)
- talkState[cid] = 0
- print("Return do Estou aqui -> 03")
- end
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment