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
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}