From 0fd1bcc39298838321f003c373642ec910974096 Mon Sep 17 00:00:00 2001 From: Azumgi <4zumgi@gmail.com> Date: Thu, 23 Aug 2018 14:52:52 +0300 Subject: [PATCH] [Chat Broadcast] Add VT2 1.2 compatibility --- vmf/scripts/mods/vmf/modules/core/chat.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vmf/scripts/mods/vmf/modules/core/chat.lua b/vmf/scripts/mods/vmf/modules/core/chat.lua index 460aa32..3f0db08 100644 --- a/vmf/scripts/mods/vmf/modules/core/chat.lua +++ b/vmf/scripts/mods/vmf/modules/core/chat.lua @@ -26,6 +26,15 @@ local function send_system_message(peer_id, message) end end +local function add_system_message_to_chat(chat_manager, message) + if OLD_RPC_CHAT_MESSAGE then + chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, message, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV) + else + chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, IS_SYSTEM_MESSAGE, POP_CHAT, + IS_DEV) + end +end + -- ##################################################################################################################### -- ##### VMFMod ######################################################################################################## -- ##################################################################################################################### @@ -51,7 +60,7 @@ function VMFMod:chat_broadcast(message) send_system_message(host_peer_id, message) end end - chat:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, message, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV) + add_system_message_to_chat(chat, message) end end