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

how to add Loot Chanel tfs 1.x

yokoderaxd

New Member
Joined
Oct 22, 2016
Messages
16
Reaction score
4
1) Create the variable for the Loot tab
Look at the top of the file where the variables are:
Code:
lootTab = nil
It should stay next to:
Code:
defaultTab = nil
serverTab = nil
lootTab = nil
2) Create function to display Loot messages
Find a free area before:
Code:
function clear()
add:
Code:
function addLootMessage(text)
    if not lootTab then
        return
    end

    addTabText(text, SpeakTypesSettings.channelOrange, lootTab)
end
3) Create a Loot tab when entering the game
Search:
Code:
function online()
Inside look for:

Code:
defaultTab = addTab(tr('Default'), true)
serverTab = addTab(tr('Server Log'), false)
Add below:
Code:
lootTab = addTab("Loot", false)
4) Prevent the player from typing in the Loot tab
Look for function:
Code:
function sendMessage(message, tab)
after:
Code:
local tab = tab or getCurrentTab()
add:

Code:
if tab == lootTab then
    return true
end


5) Clean Loot tab when disconnecting
Search:
Code:
function clear()
Search:
Code:
consoleTabBar:removeTab(serverTab)
serverTab = nil
add below:
Code:
consoleTabBar:removeTab(lootTab)
lootTab = nil


8) Search function:
Code:
function removeTab(tab)
searh:
Code:
if tab == defaultTab or tab == serverTab  then
    return
end
change for:
Code:
if tab == defaultTab or tab == serverTab or tab == lootTab then
    return
end


9) search function
Code:
function processChannelTabMenu(tab, mousePos, mouseButton)
seach:
Code:
if tab ~= defaultTab and tab ~= serverTab then
change for:
Code:
if tab ~= defaultTab and tab ~= serverTab and tab ~= lootTab then


10) search function
Code:
function onTabChange(tabBar, tab)
search:
Code:
if tab == defaultTab or tab == serverTab then
change for
Code:
if tab == defaultTab or tab == serverTab or tab == lootTab then


11) Register function to receive Opcode
Add at the end of the file:
Code:
modules.game_console = modules.game_console or {}
modules.game_console.addLootMessage = addLootMessage


12) Create Extended Opcode receiver module:
Create file: modules/game_loot/loot.lua
Code:
local LOOT_OPCODE = 226

function init()
    ProtocolGame.registerExtendedOpcode(LOOT_OPCODE, onLootOpcode)
end

function terminate()
    ProtocolGame.unregisterExtendedOpcode(LOOT_OPCODE)
end

function onLootOpcode(protocol, opcode, buffer)
    modules.game_console.addLootMessage(buffer)
end
Create File: modules/game_loot/loot.otmod

Code:
Module
  name: game_loot
  description: Loot Channel
  author: Mclovin
  website:
  sandboxed: true
  autoload: true
  scripts: [ loot ]
  @onLoad: init()
  @onUnload: terminate()


13)Search on the server: data/scripts/eventcallbacks/monster/default_onDropLoot.lua
find:
Code:
player:sendTextMessage(MESSAGE_INFO_DESCR, text)
add below the two:
Code:
player:sendExtendedOpcode(226, text)
Post automatically merged:

Sorry for my English but I speak Spanish xD
 
Last edited:
Back
Top