Files
wnsrc/gamemodes/helix/plugins/messageflash.lua
lifestorm 73479cff9e Upload
2024-08-04 22:55:00 +03:00

80 lines
3.3 KiB
Lua

--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
PLUGIN.name = "Message Flash"
PLUGIN.description = "Flashes the client's Garry's Mod application when a message is posted in the chat."
PLUGIN.author = "Aspect™"
PLUGIN.readme = [[
Many people have been in this situation: You are playing in a server, and you are waiting for something, so you decide to tab out for just a bit, to do something else. Before you know it, someone has approached you and has been waiting for you to reply to his message for several minutes.
This plugin flashes your Garry's Mod application to alert you when you receive a message, allowing you to jump back into the roleplay when needed.]]
PLUGIN.license = [[
MIT License
Copyright (c) 2021 Aspect™
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]
ix.lang.AddTable("english", {
optFlashWindow = "Windows Flash",
optdFlashWindow = "Indique si l'application Garry's Mod doit clignoter lorsqu'un message est publié dans le chat.",
optOnlyFlashDirect = "Flash sur message direct uniquement",
optdOnlyFlashDirect = "Que ce soit pour flasher l'application Garry's Mod uniquement lorsque quelqu'un vous parle directement (y compris les PM)."
})
ix.lang.AddTable("french", {
optFlashWindow = "Flash Application",
optdFlashWindow = "Indique si l'application Garry's Mod doit clignoter lorsqu'un message est publié dans le chat.",
optOnlyFlashDirect = "Flash sur message direct uniquement",
optdOnlyFlashDirect = "Que ce soit pour flasher l'application Garry's Mod uniquement lorsque quelqu'un vous parle directement (y compris les PM)."
})
ix.option.Add("flashWindow", ix.type.bool, true, {
category = "Chat"
})
ix.option.Add("onlyFlashDirect", ix.type.bool, true, {
category = "Chat"
})
if (CLIENT) then
function PLUGIN:MessageReceived(client, info)
if (!client or !info) then return end
if (ix.option.Get("flashWindow", true) and system.IsWindows() and !system.HasFocus()) then
if (ix.option.Get("onlyFlashDirect", true)) then
if (client:GetEyeTraceNoCursor().Entity == LocalPlayer() or info.chatType == "pm") then
system.FlashWindow()
end
else
system.FlashWindow()
end
end
end
end