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

Death broadcaster help

hohenz1

New Member
Joined
Jan 20, 2009
Messages
12
Reaction score
0
i think this was scripted darkhaos so any credits goto him
this was in another thread but then i noticed i should just post it in support to see if any of you have a solution.
Its supposed to broadcasts deaths but its simply not doing it
nor is it sending any errors in my console
Heres the codez

creaturescripts\scripts\playerdeath.lua
Code:
  function onDeath(cid, corpse, deathList)

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

local deathType = "killed"
local toSlain, toCrushed, toEliminated = 1, 3, 5
local broadcastType = MESSAGE_STATUS_CONSOLE_BLUE

        if #deathList >= toSlain and #deathList < toCrushed then
                deathType = "slain"
        elseif #deathList >= toCrushed and #deathList < toEliminated then
                deathType = "crushed"
        elseif #deathList >= toEliminated then
                deathType = "eliminated"
        end
                end
        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) .. " has been " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str
        end

        doBroadcastMessage(msg, broadcastType)
        return true
end

What i put in login.lua
Code:
        registerCreatureEvent(cid, "PlayerDeath")


data\creaturescripts\creaturescripts.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
	<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
	<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
	<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
	<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    	[B]<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>[/B]
	<event type="think" name="Idle" event="script" value="idle.lua"/>
	<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>  
    	<event type="advance" name="reward" event="script" value="reward.lua"/>
    	<event type="logout" name="demonOakLogout" event="script" value="demonOakLogout.lua"/>
    	<event type="death" name="demonOakDeath" event="script" value="demonOakDeath.lua"/>
	<event type="kill" name="ArenaKill" event="script" value="arenakill.lua"/>  
</creaturescripts>
Dosent work :/ Ive also tried onDeath and onKill events in the xml but neither seem to work
am i missing something? lol
3.5 tfs
ill toss in my whole login.lua if any of you need it
any help is appreciated
 
Code:
   if #deathList >= toSlain and #deathList < toCrushed then
                deathType = "slain"
        elseif #deathList >= toCrushed and #deathList < toEliminated then
                deathType = "crushed"
        elseif #deathList >= toEliminated then
                deathType = "eliminated"
        end
                end
        end

Remove the last 2 ends. Should have given an error though.
 
Back
Top