QuaS
Cykotitan Pwned =/
Hello! How to use deathList from //onDeath(cid, corpse, deathList)? This is a table of killers, how can i get the first one?(the most demage)?
deathList[1] ?
deathList[1] ?
if isPlayer(deathList[1].uid) == true then
setPlayerStorageValue(deathList[1].uid, value, 1)
end
local config = {
message = "You now have 30 seconds to exit this room.",
message1 = "You have killed one of two brothers. Kill the second and enter to the teleport.",
posit1 = { x = 2652, y = 1369, z = 5, stackpos = 1 },
acti1 = 48563,
timeToRemove = 30, -- seconds
teleportId = 3688,
bosses = { -- Monster Name, Tp To Pos, Teleport Position, Action Id
["Ungreez"] = { { x = 1411, y = 1580, z = 12, stackpos = 1 }, 0},
}
}
local function removal(position)
if getThingfromPos(position).itemid == config.teleportId then
doRemoveItem(getThingfromPos(position).uid)
end
return TRUE
end
function onDeath(cid, corpse, deathList)
local position = getCreaturePosition(cid)
for name, pos in pairs(config.bosses) do
if name == getCreatureName(cid) then
teleport = doCreateItem(config.teleportId,1,pos[1])
doBroadcastMessage(tostring(deathList), 21)
if isPlayer(deathList[1].uid) then
setPlayerStorageValue(deathList[1].uid, 46680, 2)
end
doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
addEvent(removal, config.timeToRemove * 1000, pos[1])
end
end
return TRUE
end
function onPrepareDeath(cid, deathList)
lastHitKiller = deathList[1]
mostDamageKiller = deathList[2]
lastHitKillerName = getCreatureName(deathList[1])
mostDamageKillerName = getCreatureName(deathList[2])
function onPrepareDeath(cid, deathList)
-- I need to make sure I am setting storage value to player, not monster,
-- and to make sure that player wasn't most damage killer (for example,
-- with own field you deal damage to yourself.
if(isPlayer(deathList[2]) and deathList[2] ~= cid) then
-- deathList contains IDs, so I have to use this instead of cid
setPlayerStorageValue(deathList[2], 12345, 10)
end
-- I don't want to disable entire death script (if player's health gone
-- to 0, player dies, window appears, corpse with description, blood etc.
-- so it won't interrupt if I will return TRUE
return TRUE
end