From 6417676633757fd87ec2150d4090e688fb53a85b Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Sun, 8 Aug 2021 23:10:22 +0200 Subject: [PATCH] decompiled --- .../scripting/unloze_ConsoleMessages.sp | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp diff --git a/unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp b/unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp new file mode 100644 index 00000000..eeb702be --- /dev/null +++ b/unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp @@ -0,0 +1,111 @@ +#include +#include +#include + + +int g_iTextChannel; +bool g_bDisabled; +ConVar g_cvEnabled; + +public Plugin:myinfo = +{ + name = "UNLOZE Console Messages", + description = "Make console messages printed by maps more fancy", + author = "zaCade", + version = "1.0", + url = "" +}; + +public void OnPluginStart() +{ + g_cvEnabled = CreateConVar("sm_centertext", "1", "Enable the 'game_text' message", 0, true, 0.0, true, 1.0); +} + +public void OnMapStart() +{ + new bool:bChannelTaken[6]; + new bool:bChannelFound; + new entity = -1; + while ((entity = FindEntityByClassname(entity, "game_text")) != -1) + { + new channel = GetEntProp(entity, PropType:1, "m_textParms.channel", 4, 0); + LogMessage("Checking channel: %d", channel); + if (channel < 6) + { + if (!bChannelTaken[channel]) + { + LogMessage("Channel in use: %d", channel); + bChannelTaken[channel] = true; + } + } + } + new channel; + while (channel < 6) + { + if (!bChannelTaken[channel]) + { + LogMessage("Using channel: %d", channel); + g_iTextChannel = channel; + bChannelFound = true; + if (!bChannelFound) + { + LogMessage("No channel found!"); + g_bDisabled = true; + } + return; + } + channel++; + } + if (!bChannelFound) + { + LogMessage("No channel found!"); + g_bDisabled = true; + } + return; +} + +public Action PointServerCommandForward(String:sCommand[]) +{ + if (!strncmp("say", sCommand, 3, false)) + { + new String:sMessage[512]; + new i; + while (strlen(sCommand) + -4 > i) + { + sMessage[i] = sCommand[i + 4]; + i++; + } + CPrintToChatAll("{CRIMSON}[NARRATOR] {WHITESMOKE}%s", sMessage); + if (!g_bDisabled) + { + if (g_cvEnabled.BoolValue) + { + new Handle:hMessage = StartMessageAll("HudMsg", 0); + if (hMessage) + { + BfWriteByte(hMessage, g_iTextChannel); + BfWriteFloat(hMessage, -1.0); + BfWriteFloat(hMessage, 0.15); + BfWriteByte(hMessage, 200); + BfWriteByte(hMessage, 200); + BfWriteByte(hMessage, 200); + BfWriteByte(hMessage, 255); + BfWriteByte(hMessage, 200); + BfWriteByte(hMessage, 200); + BfWriteByte(hMessage, 200); + BfWriteByte(hMessage, 255); + BfWriteByte(hMessage, 0); + BfWriteFloat(hMessage, 0.5); + BfWriteFloat(hMessage, 0.0); + BfWriteFloat(hMessage, 5.0); + BfWriteFloat(hMessage, 0.0); + BfWriteString(hMessage, sMessage); + EndMessage(); + } + } + } + return Action:4; + } + return Action:0; +} +