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

Looking for death broadcast script TFS 0.3.5

Owned420

New Member
Joined
Apr 23, 2008
Messages
37
Reaction score
0
Does anyone have a broadcasting script that will broadcast a players death regardless as to what kills them? i had a working one for my old server but its not working for TFS 0.3.5..


Thanks in advance
 
Does anyone have a broadcasting script that will broadcast a players death regardless as to what kills them? i had a working one for my old server but its not working for TFS 0.3.5..


Thanks in advance

huh? You want a broadcast even whether the player is killed by a monster or a field or a condition or a player?
 
Code:
function onDeath(cid, corpse, killer)
if isPlayer(cid) then
doBroadcastMessage("".. getPlayerName(cid) .." has been killed by ".. getCreatureName(killer) .." at ".. getPlayerLevel(cid) .." level.", 17)
end
return TRUE
end

Code:
[B]XX[/B] has been killed by [B]XX[/B] at [B]XX[/B] level.
 
Thanks for the reply , i replaced the code in deathbroadcast.lua with yours but it doesent work , do i need to add something in creaturescripts.xml?.. It appears like this..


<?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"/>

<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
<event type="login" name="Welcome!" script="loginserver.lua"/>

</creaturescripts>
 
Code:
function onDeath(cid, corpse, killer)
if isPlayer(cid) then
doBroadcastMessage("".. getPlayerName(cid) .." has been killed by ".. getCreatureName(killer) .." at ".. getPlayerLevel(cid) .." level.", 17)
end
return TRUE
end

Code:
[B]XX[/B] has been killed by [B]XX[/B] at [B]XX[/B] level.

Old function :)

Lua:
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	if(isPlayer(cid) == true and isPlayer(lastHitKiller) == true) then
		doBroadcastMessage( .. getPlayerName(cid) .." ["getPlayerLevel(cid)"]  just got killed by ".. getCreatureName(lastHitKiller) .." [".. getPlayerLevel(lastHitKiller) .."].", 17)
		end
	return true
end

Works like:
Zonet[98] just got killed by Noasa[150]

[98] <-- level.
 
lost~

Dosent seem to be working for me >.<
got the script on deathbroadcast.lua in creaturescripts/scripts
and
Code:
<event type="death" name="deathbroadcast" event="script" value="deathbroadcast.lua"/>
in the creaturescript.xml
still dosent work
tfs 3.5
what am i missing?
 
Last edited:
Still nothing :(
even tried onKill event
its not even showing errors
it crashes when i try to reload creature events in the console tho
 
Lua:
function onDeath(cid, corpse, deathList)

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

local deathType = "killed"
local toSlain, toCrushed, toEliminated = 3, 9, 15
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

Put this in login.lua
Lua:
	registerCreatureEvent(cid, "PlayerDeath")

Put this in creaturescrtips.xml
PHP:
	<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
 
Last edited:
hmm thanks darkhaos but i still have the same problem
no broadcast, no errors.
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"/>
    	<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
	<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>

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

and i added registerCreatureEvent(cid, "PlayerDeath") to login.lua still nothing >.<
 
same, no errors no broadcast, it should be on globalevents? like the server save broadcast?, i want to everyone look when some1 die.
 
Followed the instructions and still does not work , id love to use the feature though , does anyone have a working broadcaster for TFS 0.3.5 (Crying damnson)
 
i registered it on login.lua and all the others files, and nothings, I make the question again, it should be in globalsevents or creaturescripts? I have tfs 0.3.5 crying damnson.
 
this in playerdeath.lua
Code:
  function onDeath(cid, corpse, deathList)

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

local deathType = "killed"
local toSlain, toCrushed, toEliminated = 3, 9, 15
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

This in login.lua
Code:
   registerCreatureEvent(cid, "PlayerDeath")
This in creaturescripts.xml
Code:
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>


all this.
I want to when some1 die everyone see the broadcast. I use TFS 0.3.5 Crying Damson.
Thanks in advance.
 
Back
Top