decompiled
This commit is contained in:
		
							parent
							
								
									f2ce13c81e
								
							
						
					
					
						commit
						6417676633
					
				
							
								
								
									
										111
									
								
								unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,111 @@
 | 
			
		||||
#include <multicolors>
 | 
			
		||||
#include <sourcemod>
 | 
			
		||||
#include <sdktools>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user