How do you mean? Hook or print?
Code:
#include <sourcemod>
public OnPluginStart()
{
HookUserMessage(GetUserMessageId("TextMsg"), OnTextMsg, true);
RegConsoleCmd("test_message", Command_TestMessage);
}
public Action:OnTextMsg(UserMsg:MsgId, Handle:hBf, const iPlayers[], iNumPlayer, bool:bReliable, bool:bInit)
{
BfReadByte(hBf)
decl String:szMsg[64];
BfReadString(hBf, szMsg, sizeof(szMsg));
if (StrEqual(szMsg, "#Cstrike_Weapon_Special_Func"))
{
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action:Command_TestMessage(iClient, iArgs)
{
if (iClient)
{
new Handle:hMsg = StartMessageOne("TextMsg", iClient);
if (hMsg != INVALID_HANDLE)
{
BfWriteByte(hMsg, 3); // 3 = Print to chat 4 = Print center text
BfWriteString(hMsg, "#Cstrike_Weapon_Special_Func");
EndMessage();
}
}
}