PDA

View Full Version : [CS:GO] Weird problem with SayText(2) & simple-chatprocessor


pcmaster
02-28-2016, 15:29
Hello,

I am currently investigating an issue where messages sent by players in spectator get "eaten" by the server, aka. nobody apart from players in spec can actually see it.
This wouldn't be so much of a problem, if it wouldn't only affect certain maps/other weird combinations.

Code:

public Action:OnChatMessage(&author, Handle:recipients, String:name[], String:message[])
{
if(!g_bSimpleChatProcessor)
return Plugin_Continue;

if(!g_iEnabled || !g_bAuthed[author] || !g_iDisplayMethod)
return Plugin_Continue;

LogMessage("CALLED - author team: %d", GetClientTeam(author));
LogMessage("author: %d, FLAG: %d, newmsg: %d, allchat: %d", author, GetMessageFlags() & CHATFLAGS_SPEC, g_bNewMsg, g_bAllchat);

if(author && GetMessageFlags() & CHATFLAGS_SPEC && g_bNewMsg && g_bAllchat)
{
g_bNewMsg = false;
new iSize = GetArraySize(recipients);
if(g_iEnabled == 2)
{
LogMessage("Debug: Spec chat %d recipients:", iSize);
for(new i=0;i<iSize;i++)
LogMessage("Debug: client (%d) %N (team %d)", GetArrayCell(recipients, i), GetArrayCell(recipients, i), GetClientTeam(GetArrayCell(recipients, i)));
}

for (new i = 1; i <= MaxClients; i++)
{
if (Client_IsValid(i) && IsClientInGame(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR)
{
if(FindValueInArray(recipients, i) == -1)
{
PushArrayCell(recipients, i);
}
}
}

if(g_iEnabled == 2)
{
LogMessage("CALLED - author team: %d", GetClientTeam(author));
LogMessage("author: %d, FLAG: %d, newmsg: %d, allchat: %d", author, GetMessageFlags() & CHATFLAGS_SPEC, g_bNewMsg, g_bAllchat);

iSize = GetArraySize(recipients);
LogMessage("Debug: POST Spec chat %d recipients:", iSize);
for(new i=0;i<iSize;i++)
LogMessage("Debug: POST client (%d) %N (team %d)", GetArrayCell(recipients, i), GetArrayCell(recipients, i), GetClientTeam(GetArrayCell(recipients, i)));
}
}
[...]

Now, when looking in the logs for one of the affected maps (surf_happyhands2), I can see this when a spec writes (11 people on the server):

L 02/28/2016 - 21:13:58: [timer-rankings.smx] CALLED - author team: 1
L 02/28/2016 - 21:13:58: [timer-rankings.smx] author: 12, FLAG: 4, newmsg: 1, allchat: 1


While a "normale message" (CT/T), same map looks like this:

L 02/28/2016 - 21:14:01: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:01: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:01: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:01: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:01: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:01: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:01: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:01: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:01: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:01: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:04: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:04: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:04: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:04: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:04: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:04: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:04: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:04: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1
L 02/28/2016 - 21:14:04: [timer-rankings.smx] CALLED - author team: 2
L 02/28/2016 - 21:14:04: [timer-rankings.smx] author: 11, FLAG: 0, newmsg: 1, allchat: 1


Now, if I go to a working map (surf_beginner), I can see this for specs:


L 02/28/2016 - 21:09:14: [timer-rankings.smx] CALLED - author team: 1
L 02/28/2016 - 21:09:14: [timer-rankings.smx] author: 2, FLAG: 4, newmsg: 1, allchat: 0
L 02/28/2016 - 21:09:14: [timer-rankings.smx] CALLED - author team: 1
L 02/28/2016 - 21:09:14: [timer-rankings.smx] author: 2, FLAG: 4, newmsg: 1, allchat: 0


You see, spec messages are also sent for each player on the server (at the time, there were two people), while in the not working case, only once.
Therefore, the hack you can see in the code is needed, which works. The only problem is, that on working maps (like surf_beginner), the messages are then printed twice (multiple sent + multiple recipients).

Does anyone know what could be causing that (maybe a CVar I am missing)?