• 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!

Advanze DeathBroadcast helpme to finish script.

beenii

Well-Known Member
Joined
Jul 26, 2010
Messages
586
Solutions
1
Reaction score
58
Code:
function onDeath(cid, corpse, deathList)
for _, pid in ipairs(deathList) do
doBroadcastMessage(""..getCreatureName(cid).." killed at level ["..getPlayerLevel(cid).."]  by  "..getCreatureName(pid).. " ", MESSAGE_STATUS_WARNING)
end
   return true
end

11352255_10206521583336850_259305577_n.jpg


msg is repeat with diferents names, why? i want see all players killed player.
 
Your code have a for iterator looking for everyplayer on the deathlist. I dont know how deathlist works, but you might show only index 0 of the list.
 
Your code have a for iterator looking for everyplayer on the deathlist. I dont know how deathlist works, but you might show only index 0 of the list.

thanks for coment. i finally finish xP

Code:
function onDeath(cid, corpse, deathList)

local strings = {""}
local t, position = 1, 1

local deathType = "killed"
local toSlain, toCrushed = 3, 9

        if #deathList >= toSlain and #deathList < toCrushed then
                deathType = "slain"
        elseif #deathList >= toCrushed then
                deathType = "crushed"
        end

        for _, pid in ipairs(deathList) do
                if isCreature(pid) == true then
                        strings[position] = t == 1 and "" or strings[position] .. ", "
                        strings[position] = strings[position] .. getCreatureName(pid) .. ""
                        t = t + 1
                else
                        strings[position] = t == 1 and "" or strings[position] .. ", "
                        strings[position] = strings[position] .."a field item"
                        t = t + 1
                end
        end

        for i, str in ipairs(strings) do
                if(str:sub(str:len()) ~= ",") then
                        str = str .. "."
                end

                msg = getCreatureName(cid) .. " was " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str
        end
          
doBroadcastMessage(msg, MESSAGE_STATUS_WARNING)


   return true
end
 
^^Fine. you did research how the deathlist works :)
ye i only bad on create modules in OtClient, i dont know any parameters or functions on OtClient. i never see functions because no have much time. but nothing helpme with my system on OtClient i should read functions :( xD (sorry my bad english)
 
Back
Top