Raised This Month: $12 Target: $400
 3% 

[L4D2] Problems with the menu display


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-24-2016 , 00:37   [L4D2] Problems with the menu display
Reply With Quote #1

The menu is not displayed (or rather displayed only a small gray box of the background without text) in the L4D2. Only in L4D2, in other games it is displayed.
There are some differencess in creation of the menu in L4D2?
My code
PHP Code:
...
Handle g_RotateMenu;
...

public 
void OnPluginStart()
{
...
    
RegAdminCmd("sm_rotate"Cmd_RotateADMFLAG_SLAY,"Rotate menu");
...
}

public 
void OnMapStart()
{
...
    
g_RotateMenu BuildRotateMenu();
...
}


public 
Action Cmd_Rotate(int clientint args)
{
    if(
client <= MaxClients)
    {
        
DisplayMenu(g_RotateMenuclientMENU_TIME_FOREVER);
        ...
    }
    else 
ReplyToCommand(client"[SM] %t""Command is in-game only");

    return 
Plugin_Handled;
}

Handle BuildRotateMenu()
{
    
Menu rotatemenu = new Menu(Menu_Rotate);

    
rotatemenu.SetTitle("[Prop control] Rotate:\n     X (green)");
    
rotatemenu.AddItem("0""+45°");
    
rotatemenu.AddItem("1""-45°\n     Y (blue)");
    
rotatemenu.AddItem("2""+45°");
    
rotatemenu.AddItem("3""-45°\n     Z (red)");
    
rotatemenu.AddItem("4""+45°");
    
rotatemenu.AddItem("5""-45°\n     Relative to:");
    
rotatemenu.AddItem("6""world");
    
rotatemenu.AddItem("7""Set all angles to 0");
    
rotatemenu.Pagination 0;
    
rotatemenu.ExitButton true;

    return 
rotatemenu;

P.S. The menu is not displayed, but when pressing the corresponding keys all actions work.
__________________

Last edited by Grey83; 08-24-2016 at 00:40.
Grey83 is offline
Koraks
AlliedModders Donor
Join Date: Aug 2016
Location: Poland, Cracow
Old 08-24-2016 , 09:53   Re: [L4D2] Problems with the menu display
Reply With Quote #2

Hello Try this code :
PHP Code:
...
Menu g_RotateMenu;
...

public 
void OnPluginStart()
{
...
    
RegAdminCmd("sm_rotate"Cmd_RotateADMFLAG_SLAY,"Rotate menu");
...
}

public 
void OnMapStart()
{
...
    
g_RotateMenu BuildRotateMenu();
...
}


public 
Action Cmd_Rotate(int clientint args)
{
    if(
client <= MaxClients)
    {
        
DisplayMenu(g_RotateMenuclientMENU_TIME_FOREVER);
        ...
    }
    else 
ReplyToCommand(client"[SM] %t""Command is in-game only");

    return 
Plugin_Handled;
}

Menu BuildRotateMenu()
{
    
Menu rotatemenu = new Menu(Menu_Rotate);

    
rotatemenu.SetTitle("[Prop control] Rotate:\n     X (green)");
    
rotatemenu.AddItem("0""+45°");
    
rotatemenu.AddItem("1""-45°\n     Y (blue)");
    
rotatemenu.AddItem("2""+45°");
    
rotatemenu.AddItem("3""-45°\n     Z (red)");
    
rotatemenu.AddItem("4""+45°");
    
rotatemenu.AddItem("5""-45°\n     Relative to:");
    
rotatemenu.AddItem("6""world");
    
rotatemenu.AddItem("7""Set all angles to 0");
    
rotatemenu.Pagination 0;
    
rotatemenu.ExitButton true;

    return 
rotatemenu;

Koraks is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-24-2016 , 10:55   Re: [L4D2] Problems with the menu display
Reply With Quote #3

Koraks, nothing has changed.
__________________
Grey83 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-24-2016 , 12:46   Re: [L4D2] Problems with the menu display
Reply With Quote #4

I don't see the callback of your menu.
__________________
Benoist3012 is offline
Koraks
AlliedModders Donor
Join Date: Aug 2016
Location: Poland, Cracow
Old 08-24-2016 , 13:31   Re: [L4D2] Problems with the menu display
Reply With Quote #5

Try change this ->
PHP Code:
DisplayMenu(g_RotateMenuclientMENU_TIME_FOREVER); 
To ->
PHP Code:
g_RotateMenu.Display(clientMENU_TIME_FOREVER); 
If don't work please post your menu callback (Menu_Rotate)

Last edited by Koraks; 08-24-2016 at 13:31.
Koraks is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-24-2016 , 15:52   Re: [L4D2] Problems with the menu display
Reply With Quote #6

Koraks, no any change in the menu.

callback:
PHP Code:
public int Menu_Rotate(Menu rotatemenuMenuAction actionint clientint param)
{
    switch(
action)
    {
        case 
MenuAction_DisplayItem:
        {
            if(
param == 6)
            {
                
char buffer[64];
                
Format(buffersizeof(buffer), "%s"cRelative[iMWorld[client]]);
                return 
RedrawMenuItem(buffer);
            }
        }
        case 
MenuAction_Select:
        {
            
float ang[3];
    
            
int ent GetClientAimTarget(clientfalse);
        
            if(
ent MaxClients && IsValidEntity(ent))
            {
                
char ClassName[11];
                
GetEdictClassname(entClassName11);
                if(
StrContains(ClassName"npc_nmrih_"true) != 0)
                {
                    if(
StrContains(ClassName"prop_door_rotating"true) == 0GetEntPropVector(entProp_Data"m_angRotationClosed"ang);
                    else 
GetEntPropVector(entProp_Send"m_angRotation"ang);
                    switch(
param)
                    {
                        case 
0ChangeAngle(ang0true);
                        case 
1ChangeAngle(ang0);
                        case 
2ChangeAngle(ang1true);
                        case 
3ChangeAngle(ang1);
                        case 
4ChangeAngle(ang2true);
                        case 
5ChangeAngle(ang2);
                        case 
7: for (int i3i++) ang[i] = 0.0;
                    }
                    
TeleportEntity(entNULL_VECTORangNULL_VECTOR);
                    if(
StrContains(ClassName"prop_door_rotating"true) == 0SetDoorProperties(entang);
                    
SetEntPropVector(entProp_Send"m_angRotation"ang);
                }
            }
            else 
PrintHintText(client"Wrong entity");
            
DisplayMenu(g_RotateMenuclientMENU_TIME_FOREVER);
        }
        case 
MenuAction_Cancel:
        {
            if(
EffectsTimer[client] != null)
            {
                
KillTimer(EffectsTimer[client]);
                
EffectsTimer[client] = null;
            }
        }
    }
    return 
0;

But with callback all good.

P.S. The old version without 'case MenuAction_DisplayItem:{...}' had the same problems
__________________

Last edited by Grey83; 08-24-2016 at 15:56.
Grey83 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-25-2016 , 05:47   Re: [L4D2] Problems with the menu display
Reply With Quote #7

I believe the error is here:
Code:
if(param == 6) {      char buffer[64];      Format(buffer, sizeof(buffer), "%s", cRelative[iMWorld[client]]);      return RedrawMenuItem(buffer); }
You should add a debug code here, and print the buffer in chat, because if it's empty then that would explain why your vote has no items.
__________________

Last edited by Benoist3012; 08-25-2016 at 05:47.
Benoist3012 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-25-2016 , 07:56  
Reply With Quote #8

Quote:
Originally Posted by Benoist3012 View Post
I believe the error is here:
Code:
if(param == 6) {...}
You should add a debug code here, and print the buffer in chat, because if it's empty then that would explain why your vote has no items.
Quote:
Originally Posted by Grey83 View Post
P.S. The old version without 'case MenuAction_DisplayItem:{...}' had the same problems
This menu looks in the game NMRiH here so:
Spoiler
__________________

Last edited by Grey83; 08-25-2016 at 08:39. Reason: Added screenshot
Grey83 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-25-2016 , 08:42   Re: [L4D2] Problems with the menu display
Reply With Quote #9

Quote:
Originally Posted by Grey83 View Post
P.S. The old version without 'case MenuAction_DisplayItem:{...}' had the same problems
But you added it in this callback right?
Quote:
Originally Posted by Grey83
Code:
case MenuAction_DisplayItem:         {             if(param == 6)             {                 char buffer[64];                 Format(buffer, sizeof(buffer), "%s", cRelative[iMWorld[client]]);                 return RedrawMenuItem(buffer);             }         }
Quote:
Originally Posted by Benoist3012
You should add a debug code here, and print the buffer in chat
if(param == 6)
{
char buffer[64];
Format(buffer, sizeof(buffer), "%s", cRelative[iMWorld[client]]);
return RedrawMenuItem(buffer);
}
because if it's empty then that would explain why your vote has no items.
__________________

Last edited by Benoist3012; 08-25-2016 at 08:43.
Benoist3012 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 08-25-2016 , 09:13   Re: [L4D2] Problems with the menu display
Reply With Quote #10

Are you using a custom HUD in L4D2? This sounds like a client issue, got a screenshot?
__________________
asherkin is offline
Reply


Thread Tools
Display Modes

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 21:49.


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