local config = {
broadCast = FALSE, -- Red broadcast = TRUE/FALSE
monsterName = "Demon",
}
function onKill(cid, target)
if isMonster(target) == TRUE and isPlayer(cid) == TRUE then
if getCreatureName(target) == string.lower(config.monsterName) then
if config.broadCast == TRUE then
doBroadcastMessage(getPlayerName(cid).." killed a "..getCreatureName(target))
else
doPlayerSendTextMessage(cid, 22, "You killed a "..getCreatureName(target))
end
end
end
return TRUE
end
In data/creaturescripts/scripts create a file named warning.lua and paste this inside:
PHP:local config = { message = "WARNING", } function onDeath(cid, corpse, killer) local position = getCreaturePosition(cid) if BOSSNAMEHERE == getCreatureName(cid) then doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1) end return TRUE end
[/php]
Not tested, if you got any errors post here errors:
PHP:local config = { broadCast = FALSE, -- Red broadcast = TRUE/FALSE monsterName = "Demon", } function onKill(cid, target) if isMonster(target) == TRUE and isPlayer(cid) == TRUE then if getCreatureName(target) == string.lower(config.monsterName) then if config.broadCast == TRUE then doBroadcastMessage(getPlayerName(cid).." killed a "..getCreatureName(target)) else doPlayerSendTextMessage(cid, 22, "You killed a "..getCreatureName(target)) end end end return TRUE end
local config = {
broadCast = FALSE, -- Red broadcast = TRUE/FALSE
monsters = {"Demon", "Rat", "Dragon"},
}
function onKill(cid, target)
if isMonster(target) == TRUE and isPlayer(cid) == TRUE then
if isInArray(string.lower(config.monsters), getCreatureName(target)) == TRUE then
if config.broadCast == TRUE then
doBroadcastMessage(getPlayerName(cid).." killed a "..getCreatureName(target))
else
doPlayerSendTextMessage(cid, 22, "You killed a "..getCreatureName(target))
end
end
end
return TRUE
end
Is it possible to make a script that broadcast's when a player dies?
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if isPlayer(lastHitKiller) == 1 then
doBroadcastMessage("the player: ".. getPlayerName(cid) .." just die.")
else
doBroadcastMessage("the player: ".. getPlayerName(cid) .." just drop dead by a ".. getCreatureName(lastHitKiller) .."")
end
return TRUE
end
I put this in and it doesnt seem to work. :/PHP:function onDeath(cid, corpse, lastHitKiller, mostDamageKiller) if isPlayer(lastHitKiller) == 1 then doBroadcastMessage("the player: ".. getPlayerName(cid) .." just die.") else doBroadcastMessage("the player: ".. getPlayerName(cid) .." just drop dead by a ".. getCreatureName(lastHitKiller) .."") end return TRUE end
<event type="death" name="death" event="script" value="death.lua"/>
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if isPlayer(lastHitKiller) == 1 then
doBroadcastMessage("the player: getPlayerName(cid) just die.")
else
doBroadcastMessage("the player: getPlayerName(cid) just drop dead by a mob!.")
end
return TRUE
end
<event type="death" name="BroadDeath" script="death.lua"/>
registerCreatureEvent(cid, "BroadDeath")