Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onKill(cid, target, lastHit)
- if(isPlayer(target)) then
- return true
- end
- local inTask = checkPlayerIsInTask(cid)
- if #inTask >= 1 then
- local task = _MONSTERS_TASK_SYSTEM_CONFIG
- getCName = getCreatureName(target):lower()
- check = checkAlreadyDoingThisTask(cid, getCName, inTask)
- if check then -- Return Monster Name if Can Do, or false if can't
- getTask = task[check]
- if getTask then
- if getTask.inDay ~= false then
- b = getInfoPlayerTask(cid, getCName)
- data = tonumber(b[2])
- now = os.time()
- a = {sto = getTask.storage, killeds = getTask.countSto, total = getTask.count, timeToDo = getTask.inDay}
- getKills = getPlayerStorageValue(cid, a.killeds)
- if not isNumber(getKills) or getKills == nil then
- getKills = 1
- print('The '..getTask.mlist[1]..' task have some error with player '..getCreatureName(cid)..' and was FIXED Automatically by Swatt Script, please check is out.')
- end
- doneMsg = "Congratulations, you have killed "..a.total.." "..getTask.mlist[1]..", go to NPC of Task for get yours awards."
- closedMsg = "Sorry, but your "..getTask.mlist[1].." task was closed in "..os.date("%b %d, %Y at %X", data).."."
- if now < data then
- if getKills < a.total then
- calc = (getKills+1)
- setPlayerStorageValue(cid, a.killeds, tonumber(calc))
- if (getKills+1) < a.total then
- if a.timeToDo then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed " .. getPlayerStorageValue(cid, a.killeds) .. " of "..a.total.." "..getTask.mlist[1]..", you have untill "..os.date("%b %d, %Y at %X", data).." to complete this task.")
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed " .. getPlayerStorageValue(cid, a.killeds) .. "/"..a.total.." "..getTask.mlist[1]..".")
- end
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, doneMsg)
- end
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, doneMsg)
- end
- else
- doCloseTimedTask(cid, getCName)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, closedMsg)
- return true
- end
- else
- a = {sto = getTask.storage, killeds = getTask.countSto, total = getTask.count}
- getKills = getPlayerStorageValue(cid, a.killeds)
- if not isNumber(getKills) or getKills == nil then
- getKills = 1
- print('The '..getTask.mlist[1]..' task have some error with player '..getCreatureName(cid)..' and was FIXED Automatically by Swatt Script, please check is out.')
- end
- doneMsg = "Congratulations, you have killed "..a.total.." "..getTask.mlist[1]..", go to NPC of Task for get yours awards."
- if getKills < a.total then
- calc = (getKills+1)
- setPlayerStorageValue(cid, a.killeds, tonumber(calc))
- if (getKills+1) < a.total then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed " .. getPlayerStorageValue(cid, a.killeds) .. "/"..a.total.." "..getTask.mlist[1]..".")
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, doneMsg)
- end
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, doneMsg)
- end
- end
- end
- end
- end
- return TRUE
- end
Add Comment
Please, Sign In to add comment