175 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			SourcePawn
		
	
	
	
	
	
			
		
		
	
	
			175 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			SourcePawn
		
	
	
	
	
	
//====================================================================================================
 | 
						|
//
 | 
						|
// Name: [entWatch] Messages
 | 
						|
// Author: zaCade & Prometheum
 | 
						|
// Description: Handle the chat messages of [entWatch]
 | 
						|
//
 | 
						|
//====================================================================================================
 | 
						|
#include <multicolors>
 | 
						|
 | 
						|
#pragma newdecls required
 | 
						|
 | 
						|
#include <sourcemod>
 | 
						|
#include <entWatch_core>
 | 
						|
#include <entWatch_helpers>
 | 
						|
 | 
						|
#define MESSAGEFORMAT "\x07%s[entWatch] \x07%s%s \x07%s(\x07%s%s\x07%s) %t \x07%6s%s"
 | 
						|
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
// Purpose:
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
public Plugin myinfo =
 | 
						|
{
 | 
						|
	name         = "[entWatch] Messages",
 | 
						|
	author       = "zaCade & Prometheum",
 | 
						|
	description  = "Handle the chat messages of [entWatch]",
 | 
						|
	version      = "4.0.0"
 | 
						|
};
 | 
						|
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
// Purpose:
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
public void OnPluginStart()
 | 
						|
{
 | 
						|
	LoadTranslations("entWatch.messages.phrases");
 | 
						|
}
 | 
						|
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
// Purpose:
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
public void EW_OnClientItemDrop(int client, int index)
 | 
						|
{
 | 
						|
	CItem item = EW_GetItemData(index);
 | 
						|
 | 
						|
	if (item.dConfig.bDisplayEventMessages)
 | 
						|
	{
 | 
						|
		SetGlobalTransTarget(LANG_SERVER);
 | 
						|
 | 
						|
		char sClientName[32];
 | 
						|
		GetClientName(client, sClientName, sizeof(sClientName));
 | 
						|
 | 
						|
		char sClientAuth[32];
 | 
						|
		GetClientAuthId(client, AuthId_Steam2, sClientAuth, sizeof(sClientAuth));
 | 
						|
 | 
						|
		char sItemName[32];
 | 
						|
		item.dConfig.GetName(sItemName, sizeof(sItemName));
 | 
						|
 | 
						|
		char sItemColor[6];
 | 
						|
		item.dConfig.GetColor(sItemColor, sizeof(sItemColor));
 | 
						|
 | 
						|
		CRemoveTags(sClientName, sizeof(sClientName));
 | 
						|
		CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sClientName, "E562BA", "B2B2B2", sClientAuth, "E562BA", "Item Drop", sItemColor, sItemName);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
// Purpose:
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
public void EW_OnClientItemDeath(int client, int index)
 | 
						|
{
 | 
						|
	CItem item = EW_GetItemData(index);
 | 
						|
 | 
						|
	if (item.dConfig.bDisplayEventMessages)
 | 
						|
	{
 | 
						|
		SetGlobalTransTarget(LANG_SERVER);
 | 
						|
 | 
						|
		char sClientName[32];
 | 
						|
		GetClientName(client, sClientName, sizeof(sClientName));
 | 
						|
 | 
						|
		char sClientAuth[32];
 | 
						|
		GetClientAuthId(client, AuthId_Steam2, sClientAuth, sizeof(sClientAuth));
 | 
						|
 | 
						|
		char sItemName[32];
 | 
						|
		item.dConfig.GetName(sItemName, sizeof(sItemName));
 | 
						|
 | 
						|
		char sItemColor[6];
 | 
						|
		item.dConfig.GetColor(sItemColor, sizeof(sItemColor));
 | 
						|
 | 
						|
		CRemoveTags(sClientName, sizeof(sClientName));
 | 
						|
		CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sClientName, "F1B567", "B2B2B2", sClientAuth, "F1B567", "Item Death", sItemColor, sItemName);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
// Purpose:
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
public void EW_OnClientItemPickup(int client, int index)
 | 
						|
{
 | 
						|
	CItem item = EW_GetItemData(index);
 | 
						|
 | 
						|
	if (item.dConfig.bDisplayEventMessages)
 | 
						|
	{
 | 
						|
		SetGlobalTransTarget(LANG_SERVER);
 | 
						|
 | 
						|
		char sClientName[32];
 | 
						|
		GetClientName(client, sClientName, sizeof(sClientName));
 | 
						|
 | 
						|
		char sClientAuth[32];
 | 
						|
		GetClientAuthId(client, AuthId_Steam2, sClientAuth, sizeof(sClientAuth));
 | 
						|
 | 
						|
		char sItemName[32];
 | 
						|
		item.dConfig.GetName(sItemName, sizeof(sItemName));
 | 
						|
 | 
						|
		char sItemColor[6];
 | 
						|
		item.dConfig.GetColor(sItemColor, sizeof(sItemColor));
 | 
						|
 | 
						|
		CRemoveTags(sClientName, sizeof(sClientName));
 | 
						|
		CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sClientName, "C9EF66", "B2B2B2", sClientAuth, "C9EF66", "Item Pickup", sItemColor, sItemName);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
// Purpose:
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
public void EW_OnClientItemDisconnect(int client, int index)
 | 
						|
{
 | 
						|
	CItem item = EW_GetItemData(index);
 | 
						|
 | 
						|
	if (item.dConfig.bDisplayEventMessages)
 | 
						|
	{
 | 
						|
		SetGlobalTransTarget(LANG_SERVER);
 | 
						|
 | 
						|
		char sClientName[32];
 | 
						|
		GetClientName(client, sClientName, sizeof(sClientName));
 | 
						|
 | 
						|
		char sClientAuth[32];
 | 
						|
		GetClientAuthId(client, AuthId_Steam2, sClientAuth, sizeof(sClientAuth));
 | 
						|
 | 
						|
		char sItemName[32];
 | 
						|
		item.dConfig.GetName(sItemName, sizeof(sItemName));
 | 
						|
 | 
						|
		char sItemColor[6];
 | 
						|
		item.dConfig.GetColor(sItemColor, sizeof(sItemColor));
 | 
						|
 | 
						|
		CRemoveTags(sClientName, sizeof(sClientName));
 | 
						|
		CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sClientName, "F1B567", "B2B2B2", sClientAuth, "F1B567", "Item Disconnect", sItemColor, sItemName);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
// Purpose:
 | 
						|
//----------------------------------------------------------------------------------------------------
 | 
						|
public void EW_OnClientItemActivate(int client, int index)
 | 
						|
{
 | 
						|
	CItem item = EW_GetItemData(index);
 | 
						|
 | 
						|
	if (item.dConfig.bDisplayActivateMessages)
 | 
						|
	{
 | 
						|
		SetGlobalTransTarget(LANG_SERVER);
 | 
						|
 | 
						|
		char sClientName[32];
 | 
						|
		GetClientName(client, sClientName, sizeof(sClientName));
 | 
						|
 | 
						|
		char sClientAuth[32];
 | 
						|
		GetClientAuthId(client, AuthId_Steam2, sClientAuth, sizeof(sClientAuth));
 | 
						|
 | 
						|
		char sItemName[32];
 | 
						|
		item.dConfig.GetName(sItemName, sizeof(sItemName));
 | 
						|
 | 
						|
		char sItemColor[6];
 | 
						|
		item.dConfig.GetColor(sItemColor, sizeof(sItemColor));
 | 
						|
 | 
						|
		CRemoveTags(sClientName, sizeof(sClientName));
 | 
						|
		CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sClientName, "67ADDF", "B2B2B2", sClientAuth, "67ADDF", "Item Activate", sItemColor, sItemName);
 | 
						|
	}
 | 
						|
} |