• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Identification Bosses Warzone!

zetibia

Member
Joined
Jun 23, 2013
Messages
110
Reaction score
11
I'm having a problem that the players receive the storages by killing the bosses of the warzone. For example will a team of 10 people, all 10 kill BOSS, however only 1 receives the storage. Follows the Script:


function onKill(cid, target, damage, flags)
if isPlayer(cid) then
if(isMonster(target)) then
if(string.lower(getCreatureName(target)) == "deathstrike") then
setPlayerStorageValue(cid, 924877, 1)
doCreatureSay(cid, "You can get your reward now.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
end
if(isMonster(target)) then
if(string.lower(getCreatureName(target)) == "gnomevil") then
setPlayerStorageValue(cid, 924878, 1)
doCreatureSay(cid, "You can get your reward now.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
end
if(isMonster(target)) then
if(string.lower(getCreatureName(target)) == "abyssador") then
setPlayerStorageValue(cid, 924879, 1)
doCreatureSay(cid, "You can get your reward now.", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
end
end
return true
end
 
Which server do you use? If you use TFS 0.3/0.4 or a server similar to that.
You can use an onDeath script and add the storage to the players in the deathlist table. Then register it in the monster instead of login.lua since cid is now the monster.
Code:
function onDeath(cid, corpse, deathList)


If you use TFS 1.0 you can also use onDeath but then with getDamageMap() to get the table of the killers.
Code:
local damageMap = Creature(cid):getDamageMap()
for cid, damage in pairs(damageMap) do

Other option can be check the players in that area and add the storage to people who stand close to the monster that is killed is your server doesn't have an option to get the table with killers.
 
@Limos I have a question, the function gives the damageMap of the monster that dies, no?
My question is, the function gives the 'Killers-List' of the monster in order of the most damage dealer?
example:
LUA:
local mon = monster:getDamageMap()
then 'mon' will return a list but lets say that returns a list with 10 killer, the order of the killers is according of the most damage dealer to the low damage dealer?
Code:
[1] PlayerG - Damage 1500
[2] PlayerE - Damage 1300
[3] PlayerC - Damage 1100
[4] PlayerD - Damage 1000
[5] PlayerF - Damage 900
[6] PlayerB - Damage 700
[7] PlayerA - Damage 500
or just give a list of the killers, no matter the order of the damage dealed
Code:
[1] PlayerA - Damage 500
[2] PlayerB - Damage 700
[3] PlayerC - Damage 1100
[4] PlayerD - Damage 1000
[5] PlayerE - Damage 1300
[6] PlayerF - Damage 900
[7] PlayerG - Damage 1500
 
Back
Top