I tried this method but show nothing ...
If anyone know how to do please ?
PHP Code:
public OnPluginStart()
{
AddCommandListener(HookPlayerChat, "say");
}
PHP Code:
public Action:HookPlayerChat(client, const String:command[], args)
{
if((client != 0) && IsClientInGame(client))
{
if(CheckCommandAccess(client, "" ,ADMFLAG_SLAY, true))
{
decl String:szText[256];
szText[0] = '\0';
GetCmdArg(1, szText, sizeof(szText));
if (szText[0] == '/' || szText[0] == '\0')
{
return Plugin_Continue;
}
else
{
if(GetClientTeam(client) == 1)
{
PrintToChatAll("\x01\x0B\x01*SPEC* \x04[Admin] \x01%N : %s",client, szText);
return Plugin_Handled;
}
else
{
new String:name[50];
GetClientName(client, name, sizeof(name));
if(IsPlayerAlive(client))
{
Format(szText, sizeof(szText), "\x01\x0B\x04[Admin] \x03%s : %s", name, szText);
}
else
{
Format(szText, sizeof(szText), "\x01\x0B\x03*DEAD* \x04[Admin] \x03%s : %s", name, szText);
}
for (new i = 1, iClients = GetClientCount(); i <= iClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
{
SayText2(i, szText);
}
}
return Plugin_Handled;
}
}
}
}
return Plugin_Continue;
}
SayText2(to, const String:message[])
{
new Handle:hMessage = StartMessageOne("SayText2", to);
if (hMessage != INVALID_HANDLE)
{
if (GetUserMessageType() == UM_Protobuf)
{
PbSetBool(hMessage, "chat", true);
PbSetInt(hMessage, "ent_idx", to);
PbAddString(hMessage, "params", message);
PbAddString(hMessage, "params", "");
PbAddString(hMessage, "params", "");
PbAddString(hMessage, "params", "");
PbAddString(hMessage, "params", "");
}
else
{
BfWriteByte(hMessage, to);
BfWriteByte(hMessage, true);
BfWriteString(hMessage, message);
}
EndMessage();
}
}
__________________