AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Making a non interactive panel (https://forums.alliedmods.net/showthread.php?t=310995)

pandachinoman 09-29-2018 12:37

Making a non interactive panel
 
So there's a few informational plugins that use panels to display information and they're great except that they make the number keys useless, this is bad since they're only for information and don't contain any selectable items.

I'm aware that you can use SetPanelKeys to make these keys free, but I'm a big sourcemod noob and I'm just trying to modify other people's plugins not make my own so I have no idea of where should I put it to make it work.

Let's take this plugin for example: https://forums.alliedmods.net/showthread.php?p=1274550

I tried SetPanelKeys(thepanelname, (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1< <6)|(1<<7)(1<<8)); before SendPanelToClient to make keys 1-9 free but it doesn't work, same goes for SetPanelKeys(thepanelname, 1023);

The panel still blocks the number keys except 0, this plugin creates 2 panels 1 for the spectators and the other for the people who are still playing so it's a little complicated.

If someone could point me in the right direction or know how to do it right please show me I'll be eternally grateful.

Fyren 09-29-2018 17:34

Re: Making a non interactive panel
 
If you want no keys, then you'd pass 0. Though I guess it'll still enable the zero key for closing the panel?

Cruze 09-30-2018 01:36

Re: Making a non interactive panel
 
need to know the same.

Ilusion9 09-30-2018 09:34

Re: Making a non interactive panel
 
Quote:

Originally Posted by Fyren (Post 2617360)
If you want no keys, then you'd pass 0. Though I guess it'll still enable the zero key for closing the panel?

But the other keys are locked. He wants a panel with all keys unlocked. Something similar to HintText. You can press all buttons without changing the state of that hint.

MasterMind420 09-30-2018 10:06

Re: Making a non interactive panel
 
I do something like this to simulate a non interactive panel in L4D2...while allowing the number keys to still work properly.
Note...using this with a menu your constantly refreshing with a timer can be tricky,
tweak the duration on the timer to get the best result when pressing the keys...

Code:

public int SpecMenuActions(Menu menu, MenuAction action, int param1, int param2)
{
        if(action == MenuAction_Select)
        {
                switch(param2)
                {
                        case 1:
                        {
                                ShowSpecMenu(param1); //PUT YOUR MENU FUNCTION HERE AND IT WILL REOPEN THE MENU WHEN 1 IS PRESSED
                                ClientCommand(param1, "slot1"); //THIS WILL PASS CLIENT 1 KEY(L4D2)(DEPENDING ON WHATS BOUND TO 1)
                        }
                        case 2:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot2");
                        }
                        case 3:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot3");
                        }
                        case 4:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot4");
                        }
                        case 5:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot5");
                        }
                        case 6:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot6");
                        }
                        case 7:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot7");
                        }
                        case 8:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot8");
                        }
                        case 9:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot9");
                        }
                        case 0:
                        {
                                ShowSpecMenu(param1);
                                ClientCommand(param1, "slot0");
                        }
                }
        }
        else if(action == MenuAction_Cancel)
        {
                //PrintToServer("Client %d's menu was cancelled.  Reason: %d", param1, param2);
        }
        else if(action == MenuAction_End)
        {
                delete menu;
        }


DJ Tsunami 09-30-2018 10:30

Re: Making a non interactive panel
 
Seems like you could replace that entire switch statement with:
Code:

ShowSpecMenu(param1);
ClientCommand(param1, "slot%d", param2);


MasterMind420 09-30-2018 13:41

Re: Making a non interactive panel
 
Quote:

Originally Posted by DJ Tsunami (Post 2617463)
Seems like you could replace that entire switch statement with:
Code:

ShowSpecMenu(param1);
ClientCommand(param1, "slot%d", param2);


Yah good point...lol

Ilusion9 10-01-2018 07:32

Re: Making a non interactive panel
 
Quote:

Originally Posted by MasterMind420 (Post 2617457)
I do something like this to simulate a non interactive panel in L4D2...while allowing the number keys to still work properly.
Note...using this with a menu your constantly refreshing with a timer can be tricky,
tweak the duration on the timer to get the best result when pressing the keys...

But you are unable to use votes or msay or custom plugins based on panels (rules, top etc.).


All times are GMT -4. The time now is 14:15.

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