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

Lua Help with Channel Dead/Kills

mdourado

New Member
Joined
Apr 26, 2009
Messages
11
Reaction score
0
Staff, with much sweat could create a script that announces deaths
of the players on the server, but need help for that
listing is done only in a custom channel that I created, in
If the channel 10.

Below is the script that announces to broadcast:

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 = TALKTYPE_ORANGE_2

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


I've tried to replace:

Code:
 doBroadcastMessage(msg, broadcastType)

by

Code:
doPlayerSendChannelMessage(cid, "Deaths:", msg, TALKTYPE_CHANNEL_Y, CHANNEL_GAMECHAT)

I also tried to use other TALKTYPES channel and did not work: (


However no success, when I am not notified this change of
no errors however it does not send the message to the channel.

Can anyone help me?

PS: I'm using Google Translation, I'm Brazilian.
 
Code:
doBroadcastMessage("Deaths [2]: " getCreatureName(cid) .. " has been " .. deathType .. " at level " .. getPlayerLevel(cid) .. " .")

Thanks Grehy, but alas it will only cause the message to be sent as
an author of "Death," and this is not accurate.

I need the message to be sent only to a specific channel
I created and not the console or server log, only one "Channel
Deaths "(ID = 10) that I created.

Can you help?
 
Try doPlayerSendChannelMessage

Grehy, you read the whole topic up there?
I already tried that did not work.
I want to know if there is any wrong with the script, which can be done .. if
you need to rephrase, I need help for that.

I know the function you mentioned, but did not work that way. : (
 
Grehy, the example that is there in the script is the same as me you had
said and even though I used the first subject and said it did not work
in my script.

Actually, I know that the correct function is like that, even in other
scripts it works on my server, but this script it does not work!

I would be able to reset my script so that it works.
Thanks:)
 
Back
Top