Raised This Month: $32 Target: $400
 8% 

Block VGUI teammenu with protobuf?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Desktop
AlliedModders Donor
Join Date: Sep 2009
Location: C:\Users\Default\
Old 01-04-2021 , 18:52   Block VGUI teammenu with protobuf?
Reply With Quote #1

Hi, i've been trying to hook VGUI menu "teammenu" to block it showing and show a menu instead when players press "M" in CS:GO

I've read some posts about this but i still don't figure it out, my attempts to test are crashing my server.

Found this by neuroToxin

PHP Code:
public void OnPluginStart()
{
    
UserMsg umVGUIMenu GetUserMessageId("VGUIMenu");
    if (
umVGUIMenu == INVALID_MESSAGE_ID)
        
SetFailState("UserMsg `umVGUIMenu` not found!");
    
    
HookUserMessage(umVGUIMenuOnVGUIMenutrue);
    
g_hOnGetClientVGUIUrl CreateGlobalForward("OnGetClientVGUIUrl"ET_SingleParam_CellParam_StringParam_StringParam_String);
}

public 
Action OnVGUIMenu(UserMsg msg_idProtobuf msg, const int[] playersint playersNumbool reliablebool init)
{
    
char name[7];
    
msg.ReadString("name"namesizeof(name));
    
    
int client players[0];
    
PrintToConsole(client"> OnVGUIMenu(name='%s', show=%d)"namemsg.ReadBool("show"));
    
    if (!
StrEqual(name"info"))
        return 
Plugin_Continue;
    
    
Protobuf subkey[3]; int subkeylookup[3];
    for (
int i 03i++)
    {
        
subkey[i] = msg.ReadRepeatedMessage("subkeys"i);
        
subkey[i].ReadString("name"namesizeof(name));
        
//PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].name='%s'", i, name);
        
        
if (StrEqual(name"title"))
        {
            
subkeylookup[0] = i;
            
subkey[i].ReadString("str"g_sTitlesizeof(g_sTitle));
            
//PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].str='%s'", i, g_sTitle);
        
}
        else if (
StrEqual(name"type"))
        {
            
subkeylookup[1] = i;
            
subkey[i].ReadString("str"g_sTypesizeof(g_sType));
            
//PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].str='%s'", i, g_sType);
        
}
        else if (
StrEqual(name"msg"))
        {
            
subkeylookup[2] = i;
            
subkey[i].ReadString("str"g_sMessagesizeof(g_sMessage));
            
//PrintToConsole(client, "> OnVGUIMenu.subkeys[%d].str='%s'", i, g_sMessage);
        
}
    }
    
    if (
StrEqual(g_sType"1") && StrEqual(g_sMessage"motd"))
    {
        
Action result;
        
Call_StartForward(g_hOnGetClientVGUIUrl);
        
Call_PushCell(client);
        
Call_PushString(g_sTitle);
        
Call_PushString(g_sType);
        
Call_PushString(g_sMessage);
        
Call_Finish(result);
        
        if (
result == Plugin_Stop)
        {
            
PrintToConsole(client"> MOTD BLOCKED");
            
msg.SetBool("show"false);
            
delete subkey[0];
            
delete subkey[1];
            
delete subkey[2];
            return 
Plugin_Continue;
        }
        
        if (
result == Plugin_Changed)
        {
            
subkey[subkeylookup[0]].SetString("str"g_sTitle);
            
subkey[subkeylookup[1]].SetString("str"g_sType);
            
subkey[subkeylookup[2]].SetString("str"g_sMessage);
            
            
//PrintToConsole(client, "> OnVGUIMenu.title='%s'", g_sTitle);
            
PrintToConsole(client"> OnVGUIMenu.type='%s'"g_sType);
            
PrintToConsole(client"> OnVGUIMenu.msg='%s'"g_sMessage);
        }
    }
    
    
delete subkey[0];
    
delete subkey[1];
    
delete subkey[2];
    return 
Plugin_Continue;

Can someone help me understand how to properly do this?
__________________
Massive Infection:: Piu-Games
Desktop is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 01-05-2021 , 07:52   Re: Block VGUI teammenu with protobuf?
Reply With Quote #2

Start with this:

PHP Code:

public void OnPluginStart()
{
    
UserMsg umVGUIMenu GetUserMessageId("VGUIMenu");
    if (
umVGUIMenu == INVALID_MESSAGE_ID)
        
SetFailState("UserMsg `umVGUIMenu` not found!");
    
    
HookUserMessage(umVGUIMenuOnVGUIMenutrue);
}

public 
Action OnVGUIMenu(UserMsg msg_idProtobuf msg, const int[] playersint playersNumbool reliablebool init)
{
    
char name[64];
    
msg.ReadString("name"namesizeof(name));
   
LogMessage("vgui name: %s"name);

See if its printing something, but with panorama this no more works...
__________________
Ilusion9 is offline
Desktop
AlliedModders Donor
Join Date: Sep 2009
Location: C:\Users\Default\
Old 01-05-2021 , 14:34   Re: Block VGUI teammenu with protobuf?
Reply With Quote #3

Returned this:

PHP Code:
L 01/05/2021 14:18:41: [test.smxvgui namespecmenu
L 01
/05/2021 14:18:41: [test.smxvgui namespecgui
L 01
/05/2021 14:18:41: [test.smxvgui nameoverview 
doesnt block it with this code:
PHP Code:
public Action OnVGUIMenu(UserMsg msg_idProtobuf msg, const int[] playersint playersNumbool reliablebool init){
    
    
char name[64];
    
msg.ReadString("name"namesizeof(name));
    
    
int client players[0];
    
    if (
StrEqual(name"specmenu") || StrEqual(name"specgui"))
        return 
Plugin_Continue// tried with _Stop and _Handled

but it still opens when i press 'M', maybe im not getting right how to work with these hooks
__________________
Massive Infection:: Piu-Games

Last edited by Desktop; 01-05-2021 at 14:35.
Desktop is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 01-05-2021 , 14:46   Re: Block VGUI teammenu with protobuf?
Reply With Quote #4

You should search for "team" or "teammenu", but VGUIMenu doesn't trigger teammenu anymore with panorama. You cannot hook it and cannot block it.
__________________
Ilusion9 is offline
Desktop
AlliedModders Donor
Join Date: Sep 2009
Location: C:\Users\Default\
Old 01-07-2021 , 00:08   Re: Block VGUI teammenu with protobuf?
Reply With Quote #5

Valve continues not giving a f about community servers in csgo.. there are so many less customization than other games
__________________
Massive Infection:: Piu-Games
Desktop is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode