So after the recent update on CS:GO, my old method of overriding a MOTD URL is glitching the Team Selection Menu.
Here is some spanking new code that overrides the MOTD URL without having to block / resend a new umVGUIMenu protobuffer.
Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
public void OnPluginStart()
{
UserMsg umVGUIMenu = GetUserMessageId("VGUIMenu");
if (umVGUIMenu == INVALID_MESSAGE_ID)
SetFailState("UserMsg `umVGUIMenu` not found!");
HookUserMessage(umVGUIMenu, OnVGUIMenu, true);
}
public Action OnVGUIMenu(UserMsg msg_id, Protobuf msg, const int[] players, int playersNum, bool reliable, bool init)
{
char name[7];
msg.ReadString("name", name, sizeof(name));
if (!StrEqual(name, "info"))
return Plugin_Continue;
int client = players[0];
PrintToConsole(client, "OnVGUIMenu");
PrintToConsole(client, "> OnVGUIMenu.name='%s'", name);
PrintToConsole(client, "> OnVGUIMenu.show=%d", msg.ReadBool("show"));
Protobuf subkey[3]; int subkeylookup[2];
char title[128];
char type[2];
char message[1024];
for (int i = 0; i < 3; i++)
{
subkey[i] = msg.ReadRepeatedMessage("subkeys", i);
subkey[i].ReadString("name", name, sizeof(name));
PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].name='%s'", i, name);
if (StrEqual(name, "type"))
{
subkeylookup[0] = i;
subkey[i].ReadString("str", type, sizeof(type));
PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].str='%s'", i, type);
}
else if (StrEqual(name, "msg"))
{
subkeylookup[1] = i;
subkey[i].ReadString("str", message, sizeof(message));
PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].str='%s'", i, message);
}
else if (StrEqual(name, "title"))
{
subkey[i].ReadString("str", title, sizeof(title));
PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].str='%s'", i, title);
}
}
if (StrEqual(type, "1") && StrEqual(message, "motd"))
{
subkey[subkeylookup[0]].SetString("str", "2");
subkey[subkeylookup[1]].SetString("str", "http://console.aus-tg.com");
PrintToConsole(client, "> OnVGUIMenu.type='2'");
PrintToConsole(client, "> OnVGUIMenu.msg='http://console.aus-tg.com'");
}
delete subkey[0];
delete subkey[1];
delete subkey[2];
return Plugin_Continue;
}
__________________