Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onSay(cid, item, param)
- local topic = nil
- if param == "" then
- doPlayerSendTextMessage(cid, 18, "Welcome to taskmanager. Here are some commands you can use to get started.\n!task monster-name, !task cancel, !task list, !task current")
- end
- -- Cancel task
- if param == "cancel rotworm" then
- doPlayerSendTextMessage(cid, 18, "Are you sure you want to cancel this task? Say '!task yes' to confirm or '!task no' to decline.")
- topic = 1
- elseif topic == 1 then
- if param == "yes" then
- doPlayerSendTextMessage(cid, 18, "So be it. Your progress on the rotworm task has been wiped out. Do you want to start a new task?")
- topic = nil
- else
- doPlayerSendTextMessage(cid, 18, "No? Then you will keep your progress in the rotworm task.")
- topic = nil
- end
- if param == "cancel dragon" then
- doPlayerSendTextMessage(cid, 18, "Are you sure you want to cancel this task? Say '!task yes' to confirm or '!task no' to decline.")
- topic = 2
- elseif topic == 2 then
- if param == "yes" then
- doPlayerSendTextMessage(cid, 18, "So be it. Your progress on the dragon task has been wiped out. Do you want to start a new task?")
- topic = nil
- else
- doPlayerSendTextMessage(cid, 18, "No? Then you will keep your progress in the dragon task.")
- topic = nil
- end
- -- Keywords
- elseif param == "monster" then
- doPlayerSendTextMessage(cid, 18, "For example, say '!task rotworm' to start the rotworm task.")
- elseif param == "cancel" then
- doPlayerSendTextMessage(cid, 18, "For example, say '!task cancel rotworm' to cancel the rotworm task.")
- elseif param == "current" or param == "progress" then
- local k = getPlayerStorageValue
- doPlayerSendTextMessage(cid, 18, and
- k(cid, 100) >= 0 "You are currently in the rotworm task. Your progress report is: ".. 200 - k .. " killed rotworms." or
- k(cid, 101) >= 0 "You are currently in the dragon task. Your progress report is: ".. 500 - k .. " killed dragons." or
- "You have not yet begun a task. Would you like to do so, you can see the avaialbe task by saying '!task list'.")
- elseif param == "list" then
- doShowTextDialog(cid, 1948, "Available tasks:\nRotworms [200]\nDragons [500]")
- -- Egnition from this point
- -- Rotworms
- elseif param == "rotworm" then
- local v = getPlayerStorageValue(cid, 100)
- local a = 200
- if getPlayerStorageValue(cid, 200) > 0 then
- if v < (a + 1) and v > 0 then
- doPlayerSendTextMessage(cid, 18, "You have killed ".. v .." ".. param ..". You have to kill ".. a - v .." more to finish the task.")
- elseif v < 1 then
- doPlayerSendTextMessage(cid, 18, "".. param .." task has been started. Kill ".. a.. " ".. param .." to claim your price.")
- setPlayerStorageValue(cid, 100, 0)
- setPlayerStorageValue(cid, 200, 1)
- elseif getPlayerStorageValue(cid, 100) > a then
- doPlayerSendTextMessage(cid, 18, "You have already finished this task.")
- elseif getPlayerStorageValue(cid, 100) == a then
- -- Stop the killcount on 200 or on the local variable 'a'
- doPlayerSendTextMessage(cid, 18, "Congratulations! You have finished the "... param .." task.")
- doPlayerAddItem(cid, 2152, 50)
- setPlayerStorageValue(cid, 100, v + 1)
- end
- else
- doPlayerSendTextMessage(cid, 18, "You have already taken on a task. Please finish or cancel it first.")
- end
- -- Dragons
- elseif param == "dragon" then
- local v = getPlayerStorageValue(cid, 101)
- local a = 500
- if getPlayerStorageValue(cid, 200) > 0 then
- if v < (a + 1) and v > 0 then
- doPlayerSendTextMessage(cid, 18, "You have killed ".. v .." ".. param ..". You have to kill ".. a - v .." more to finish the task.")
- elseif v < 1 then
- doPlayerSendTextMessage(cid, 18, "".. param .." task has been started. Kill ".. a.. " ".. param .." to claim your price.")
- setPlayerStorageValue(cid, 101, 0)
- setPlayerStorageValue(cid, 200, 1)
- elseif getPlayerStorageValue(cid, 101) > a then
- doPlayerSendTextMessage(cid, 18, "You have already finished this task.")
- elseif getPlayerStorageValue(cid, 101) == a then
- -- Stop the killcount on 500 or on the local variable 'a'
- doPlayerSendTextMessage(cid, 18, "Congratulations! You have finished the "... param .." task.")
- doPlayerAddItem(cid, 2152, 50)
- setPlayerStorageValue(cid, 101, v + 1)
- end
- else
- doPlayerSendTextMessage(cid, 18, "You have already taken on a task. Please finish or cancel it first.")
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement