function onKill(cid, target, lastHit) -- Security check dla potworów, jeśli gdzieś są używane storage w potworach, żeby się nie gryzło z Task Systemem if not isPlayer(cid) then return true end -- Sprawdzanie czy `target` jest graczem, security check if isPlayer(target) then return true end local startedTasks = getPlayerStartedTasks(cid) local monsterName = getCreatureName(target):lower() for taskmonster, task_id in ipairs(startedTasks) do if(startedTasks and #startedTasks > 0) then local currentTask = tasks[task_id] if isInArray(currentTask.creatures, monsterName) then local status = KILLSSTORAGE_BASE + task_id if(getPlayerStorageValue(cid, status) < 0) then setPlayerStorageValue(cid, status, 0) end local killsCount = getPlayerStorageValue(cid, status) -- Dla solo if killsCount < currentTask.killsRequired then setPlayerStorageValue(cid, status, killsCount + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You killed " ..(killsCount+1).. " of " .. currentTask.killsRequired .. " " .. currentTask.raceName .. " so far.") if killsCount == currentTask.killsRequired then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! You completed " .. currentTask.raceName .. " task! (Killed " ..(killsCount+1).. " of " .. currentTask.killsRequired .. "). Go back to Grizzly Adams and report it to get reward!") end local party = getPartyMembers(cid) -- Dla Party if party then for it, member in ipairs(party) do local member_status = getPlayerStorageValue(member, status) -- isPartySharedExperienceActive(member) // canUseSharedExperience if (not member == cid) and (member and canUseSharedExperience(member)) then -- Musi być share włączone, żeby zaliczało task. if member_status < currentTask.killsRequired then setPlayerStorageValue(member, status, killsCount + 1) doPlayerSendTextMessage(member, MESSAGE_STATUS_CONSOLE_BLUE, "You killed " ..(killsCount+1).. " of " .. currentTask.killsRequired .. " " .. currentTask.raceName .. " so far.") if member_status == currentTask.killsRequired then doPlayerSendTextMessage(member, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! You completed " .. currentTask.raceName .. " task! (Killed " ..(killsCount+1).. " of " .. currentTask.killsRequired .. "). Go back to Grizzly Adams and report it to get reward!") end end end break end end end end end end return true end