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

Broadcast when killed on Latest TFS alpha 4 - Spells animation color

mamon_2

Banned User
Joined
Jul 2, 2007
Messages
424
Reaction score
0
Like topic name says, if anyone knows how to do a broadcast when killed and make spells to be told like a animation when monsters talks, in orange, so they doesnt disturb at default channel.

Anyone?
 
\data\creaturescripts\scripts\playerdeath.lua

local config = {
deathListEnabled = getConfigInfo('deathListEnabled'),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}

function onDeath(cid, corpse, killer)
doBroadcastMessage(""..getCreatureName(cid).." was killed by "..getCreatureName(killer).." at level " ..getPlayerLevel(cid).."", MESSAGE_STATUS_WARNING)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
if(config.deathListEnabled == "yes") then
if(killer ~= FALSE) then
if(isPlayer(killer) == TRUE) then
killerName = getPlayerGUID(killer)
else
killerName = getCreatureName(killer)
end
else
killerName = "field item"
end

db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(killerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local deathRecords = rows:numRows(true)
if(config.sqlType == "sqlite") then
while(deathRecords > config.maxDeathRecords) do
db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
deathRecords = deathRecords - 1
end
else
while(deathRecords > config.maxDeathRecords) do
db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1;")
deathRecords = deathRecords - 1
end
end
end
end
end
 
Working one -(Tested on TFS 0.3beta2)


just add this to data\creaturescripts\scripts\playerdeath.lua
Code:
function onDeath(cid, corpse, killer)
    if isPlayer(killer) == TRUE then
doBroadcastMessage(""..getCreatureName(cid).." was killed by "..getCreatureName(killer).." at level " ..getPlayerLevel(cid).."", MESSAGE_STATUS_WARNING)
        end

:thumbup:
 
I'm noob but maybe this should work

PHP:
if isPlayer(killer) == TRUE then
doBroadcastMessage(""..getCreatureName(killer).."["..getPlayerLevel(killer).."]just killed "..getCreatureName(cid).."["..getPlayerLevel(cid).."]", MESSAGE_STATUS_WARNING)

Put this under function onDeath ofc on playerdeath.lua

write another end on the bottom of the script.(i think) use notepad++ and see if it needs a extra end.
 
Back
Top