I think this is better:
Hide !knife, !ws and etc messages and print info.
Source:
PHP Code:
public Plugin myinfo =
{
name = "Hide Messages",
author = "Someone (AM Russian85)",
version = "1.0",
url = "http://hlmod.ru"
};
ArrayList g_hArray;
public void OnPluginStart()
{
g_hArray = new ArrayList(ByteCountToCells(32));
RegAdminCmd("sm_hm_reload", CMD_RELOAD, ADMFLAG_ROOT);
LoadConfig();
}
public Action CMD_RELOAD(int iClient, int iArgs)
{
LoadConfig();
return Plugin_Handled;
}
void LoadConfig()
{
g_hArray.Clear();
KeyValues Kv = new KeyValues("Messages");
char sBuffer[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sBuffer, sizeof(sBuffer), "configs/hide_messages.ini");
if (!FileToKeyValues(Kv, sBuffer)) SetFailState("Unable to find config file %s", sBuffer);
if (Kv.GotoFirstSubKey())
{
do
{
if (Kv.GetSectionName(sBuffer, sizeof(sBuffer)))
{
g_hArray.PushString(sBuffer);
}
}
while (Kv.GotoNextKey());
}
delete Kv;
}
public Action OnClientSayCommand(int iClient, const char[] sCommand, const char[] sArgs)
{
if(IsClientInGame(iClient) && !IsFakeClient(iClient) && g_hArray.FindString(sArgs) != -1)
{
PrintToChat(iClient, "We do not have this plugin because it's against Valve's TOS. We are children of Jesus.");
return Plugin_Handled;
}
return Plugin_Continue;
}
Config:
PHP Code:
"Messages"
{
"!knife"{}
"!ws"{}
}