this is just a stripped down version of
bequite plugin by
sirplease (all credits goes to them)
PHP Code:
// this is a fork from 'bequite' plugin
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#define PLUGIN_VERSION "1.0.0"
public Plugin myinfo =
{
name = "[L4D1 & 2] chat message 'idle' blocker",
author = "Sir, Forgetest",
description = "Suppress the printing of the chat message '<player-name> is now idle'",
version = PLUGIN_VERSION,
url = "-"
}
public void OnPluginStart()
{
HookUserMessage(GetUserMessageId("TextMsg"), UserMsg_TextMesg, true);
}
Action UserMsg_TextMesg(UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init)
{
int client = msg.ReadByte();
if (!IsValidClient(client))
return Plugin_Continue;
static char sMsg[128];
sMsg[0] = 0;
msg.ReadString(sMsg, sizeof(sMsg), true);
if (strcmp(sMsg, "#L4D_idle_spectator") == 0)
return Plugin_Handled;
return Plugin_Continue;
}
stock bool IsValidClient(int client)
{
return client > 0 && client <= MaxClients && IsClientInGame(client);
}