From f4476a24580172b1f58605c159c05859634378a3 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:27:01 +0100 Subject: [PATCH] Fix "PlayBink" kick on Console Command When a custom script sends a video to a player's console with "PlayBink" the player will be systematically kicked out --- scripts/eventHandler.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index 923f013a..6720e3d5 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -1659,12 +1659,19 @@ eventHandler.OnVideoPlay = function(pid) tes3mp.LogAppend(enumerations.log.INFO, "- packetOrigin was " .. tableHelper.getIndexByValue(enumerations.packetOrigin, packetOrigin)) - if logicHandler.IsPacketFromConsole(packetOrigin) and not logicHandler.IsPlayerAllowedConsole(pid) then + local consoleCommand = tes3mp.GetObjectListConsoleCommand() + local hasConsoleVideoQueued = tableHelper.containsValue(Players[pid].consoleVideosQueued, consoleCommand) + + if logicHandler.IsPacketFromConsole(packetOrigin) and not logicHandler.IsPlayerAllowedConsole(pid) and not hasConsoleVideoQueued then tes3mp.Kick(pid) tes3mp.SendMessage(pid, logicHandler.GetChatName(pid) .. consoleKickMessage, true) return end + if hasConsoleVideoQueued then + Players[pid].consoleVideosQueued = {} + end + if config.shareVideos == true then tes3mp.LogMessage(enumerations.log.INFO, "Sharing VideoPlay from " .. logicHandler.GetChatName(pid))