• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua All players that do damage gain storage (Function onKill)

chauffaille

New Member
Joined
Sep 10, 2009
Messages
198
Reaction score
1
Hello,
I have a question about function onkill,
the task counts only for the player who gives the last hit, I would like to know how I modify the script to the task count for all players who damage monster



Lua:
function onKill(cid, target, lastHit)
if(isMonster(target) == true) then
local n = string.lower(getCreatureName(target))
for race, mob in pairs(tasktabble) do
if getPlayerStorageValue(cid,mob .storage_start) >= 1 then
for i = 1,#mob.monster_race do
if n == mob.monster_race[i] then
local contagem = getPlayerStorageValue(cid, mob.storage)
if (contagem == -1) then contagem = 1 end
if not tonumber(contagem) then return true end
if contagem > mob.count then return true end
if contagem > mob.count then return true end
setPlayerStorageValue(cid, mob.storage, contagem+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,""..(contagem == mob.count and "Congratulations! You finished the task of "..race.."." or "defeated. Total [" .. contagem .. "/" .. mob.count .. "] " .. race .. ".").."")
end
end
 
thanks for reply
My distro don't have the function GetDamageMap, im using OTX2, there is another way to do it?
I guess you could write it yourself using onHealthChange function but I wouldn't advise it. I would suggest finding the commit for getDamageMap within TFS and try to add this commit to your OTX distro.
 
Back
Top