• Vote in May Mapping Competition to select a winner!
  • 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
Best answers
0
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
 
OP
chauffaille

chauffaille

New Member
Joined
Sep 10, 2009
Messages
198
Best answers
0
Reaction score
1
thanks for reply
My distro don't have the function GetDamageMap, im using OTX2, there is another way to do it?
 

Apollos

Dude who does stuff
Joined
Apr 22, 2009
Messages
756
Best answers
114
Reaction score
520
Location
United States
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.
 

Evil Hero

Legacy Member
TFS Developer
Joined
Dec 12, 2007
Messages
1,210
Best answers
21
Reaction score
583
Location
Germany
You can use
Lua:
onDeath(cid, corpse, deathList)
deathList will give you exactly what you search for.
 
OP
chauffaille

chauffaille

New Member
Joined
Sep 10, 2009
Messages
198
Best answers
0
Reaction score
1
thanks guys, i will try to use deathlist, thanks alot :D
 
Top