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

[L4D] Help needed with a panel menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 03-12-2023 , 13:01   [L4D] Help needed with a panel menu
Reply With Quote #1

Hello modders,

I have created a panel menu that lists some of my server's chat commands and rules, that gets activated as a side-menu by using the [tab] key. However, I am facing a limitation in terms of the number of lines I can use, as I am only able to create 14 lines of text at most. I would like to double the length of the main panel page if I can, or at least be able to include up to 40 lines of text in total. My version is a basic static panel and is a fork of another plugin created by OtterNas3. I have attached a copy of my script below, which may hopefully provide some insight that may help me resolve this issue.
Spoiler

Any help with this would be greatly appreciated.

Sunyata

Last edited by Sunyata; 03-12-2023 at 13:04.
Sunyata is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 03-14-2023 , 02:38   Re: [L4D] Help needed with a panel menu
Reply With Quote #2

i am not sure but it seem that panel only can show 255 character at all.
LinLinLin is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 03-14-2023 , 03:27   Re: [L4D] Help needed with a panel menu
Reply With Quote #3

Oh...okay, that's a bummer if that's the case. So it would seem that a panel page has its own set of limitations.

It looks like I might have to switch over to using a nested menu system if that helps address my requirements.
Sunyata is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-14-2023 , 04:12   Re: [L4D] Help needed with a panel menu
Reply With Quote #4

Extra Menu API
__________________
Silvers is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 03-14-2023 , 04:46   Re: [L4D] Help needed with a panel menu
Reply With Quote #5

Hey Silvers, thanks. This may well be just what I'm looking for.
Cheers.
Sunyata is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 11-01-2023 , 06:09   Re: [L4D] Help needed with a panel menu
Reply With Quote #6

As a follow-up to my opening post, I finally managed to find a creative solution to give me a customised multi-panel menu system that works using the TAB + USE keys. My custom script uses a three-panel page menu system on a 25-second timer for each panel page -- or the pages can be switched between manually by pressing the TAB + USE keys repeatedly. This fork is based on the author OtterNas3’s plugin but has been heavily customised by me, specifically for use on my server.

Here’s the [ANIMATION] of how it actually works in-game.

This bespoke plugin of mine is not very polished code-wise, and it needs a lot of improvement by a more experienced coder - I’m more of a hacker looking for a quick fix to meet my gaming needs. But for this script to be more suited to the community here, the code needs to be better optimised and cleaned up and perhaps have its own translation data text file for personalising the panel messages.

So, if anyone here is interested in making a better community-based plugin from my version, then PM me and I’ll send the script to you personally.
Sunyata is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 11-25-2023 , 06:57   Re: [L4D] Help needed with a panel menu
Reply With Quote #7

Hi 101, thanks for sharing your script. However, yours offers a nested menu system similar to this [plugin here], which is not suitable for my requirements. If I were to use a nested system, I would have opted for Silver's version above, as it uses panel menus like my script does. With my plugin, it's very simple, as nothing needs to be navigated using number keys.

To reiterate: When a player connects to the game, they are initially greeted by all three menu panels for just 5 seconds — enough time to inform the player that a help menu is available at a glance. The player can then either use the chat command '!help' to reactivate the menus or simply use TAB + E (USE) keys to cycle through each menu. Although each menu is only displayed for 25 seconds, the player can easily recycle a particular menu to extend its reading time. I believe my plugin provides a more elegant solution without asking the player to think too much about what to do with key presses for a nested menu system.
Sunyata is offline
101
Member
Join Date: Nov 2023
Old 11-26-2023 , 19:31   Re: [L4D] Help needed with a panel menu
Reply With Quote #8

I'm still having trouble reading codes, and i think Plugin Extra_menus adding complexity to the menu system itself .
Anyway, Menu is (A Very-Advanced Panel) , Menu can magically turn into Panel with the SAME text-size , Plus it has the ability to carry Extra-Info with each item Then auto creates pages .
Menu Is The Best Offer , i think Panels have to be deleted from sourcemod , this is the best practical and simple model that can be used for alerting and advertising :

PHP Code:
#include <sourcemod>

#define Num_Of_Panels    2        // Change if Only u Add Panel_Text[2]..Panel_Text[3]...Panel_Text[100] (in case u create Panel_Text[100] MAKE SURE THAT : Num_Of_Panels is 101)

bool  Console_Allow    true         //false : To Disable Print Panels Text On Client Console
bool E_action[MAXPLAYERS+1];    //for Advanced Option (Alternative Double E Press, you Can Delete All Advanced Stuff)

char Panel_Text[Num_Of_Panels][524];
int C_Page[MAXPLAYERS+1];

public 
OnPluginStart() 
{
    
//fill first panel manually (use \n to start new raw)
    
Panel_Text[0] ="Server Commands\n!csm - Character Select Menu to select your own Character\n!perks - Show Current Upgrades\nUpgrades are Auto Given To Player\n!P - Send Private Message\nYou Can Send Private message to other players by type !P\nAnd Then Choose your Target From Menu\n!rank - Show rank\nType Top10 To Display the Most Active 10 Players\n!buy - Items Shop Menu [Server Menu Shop] ..\nYou Can Buy Items \nIf You Had Enough Points from Killing .. Helping other ..ect\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbz";

    
//fill second panel manually 
    
Panel_Text[1]="Server Rules\n#RULE 1\nAAAAAAAAAAAAAAAAAAAAAAA\n#RULE 2\nCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCC\n#RULE 3\nZZZZZZZZZZZZZZZZZZZZZZZ";
    
    
//.... You Can Create Panel_Text[2]... Panel_Text[3] ....And So On ...
    //(But DONT FORGET TO INCREASE Num_Of_Panels Above)....
    //Note:The MAX LETTERS THAT PANELS CAN HANDLE IS 524 
    //This May Help You http://bytesizematters.com/
}

public 
OnClientPostAdminCheck(P)
{
    
CreateTimer(20.0,Notify_Timer,P,TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
}

public 
Action:Notify_Timer(Handle:T,any:P)
{
    if (
Notify(P))
    {
        return 
Plugin_Continue;
    }
    return 
Plugin_Stop;
}

Notify(int P)
{
    if (
IsClientConnected(P) && C_Page[P]<Num_Of_Panels)
    {
        
Show_Commands_Panel(P,C_Page[P]);
        
C_Page[P]++;
    }
    else 
C_Page[P]=0;
    return 
C_Page[P];
}
Show_Commands_Panel(int P,int X)
{
    new 
Handle:C_P=CreateMenu(CP);
    
SetMenuTitle(C_P,Panel_Text[X]);
    
AddMenuItem(C_P,"Fake","Close",ITEMDRAW_NOTEXT);
    
DisplayMenu(C_P,P,20);
    
    if (
Console_Allow)
    
PrintToConsole(P,Panel_Text[X]);
    
    
ClientCommand(P,"playgamesound UI/menu_countdown.wav");
}

public 
CP(Handle:h1,MenuAction:a,P,itemnum)
{
    if (
a==MenuAction_End)delete h1
}

//-----------------ADVANCED(Double E Press)----------
public Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat vel[3], float angles[3], int &weapon)
{
    if (
buttons&IN_USE    &&    !(GetEntProp(client,Prop_Data,"m_nOldButtons")&IN_USE))
    {
        if (!
E_action[client])
        {
            
E_action[client]=true;
            
CreateTimer(0.2,Close,client);
        }
        else
        {
            
Notify(client);
        }    
    }
    return 
Plugin_Continue;
}

public 
Action:Close(Handle:S,any:P)E_action[P]=false
hoping to serve you .
... Greetings to all of you
Attached Files
File Type: sp Get Plugin or Get Source (RULES_Sample2_Advanced.sp - 34 views - 2.7 KB)

Last edited by 101; 11-26-2023 at 19:49.
101 is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 11-27-2023 , 09:09   Re: [L4D] Help needed with a panel menu
Reply With Quote #9

Hi again 101,

Your first reply post to mine has now vanished. It makes me look like a madman having a conversation with myself.

Your latest panel menu script is really nice. Your code is way more optimised and streamlined compared to my poor coding efforts. I love the way that you can add extra panel menus, that a nice touch, and the double-tap on the ‘USE’ key is a nice touch too.

I may need another menu instructions page for my server later, so your script could let me add that extra menu page very easily.

But I have a few suggestions to make: In my animation, when a player joins my server they see my 3 intro menus displayed for 2 seconds at 2 seconds intervals. This is to catch a player's attention quickly - so they can just focus on playing the game without being too distracted. My script has CVAR timers for showing a player the intro menu after 40 seconds, then uses another CVAR for displaying each menu for 2 seconds - what I call the 'glance' menus, with yet another CVAR for them to display at 2-second intervals. Then the ‘USE’ key has its own CVAR set at 25 seconds to cycle through each of the 3 menus. So I'm wondering, could your script also include such CVARs? That would be very useful to have if you later decide to release your plugin to the whole community here.

Also, it would be nice to have the menu texts taken away from the script and added to a ‘cfg’ or ‘gamedata’ file. I have presumed you've thought of doing that eventually anyway. Also, it would be nice to have a chat command to activate the first command menu alone - using something like !help etc for just the chat commands.

Having said all that, I really do like your new script, so many thanks for posting it here.

EDIT: If you want to know more about how my plugin functions in-game for yourself, I can PM my script to you, assuming you want to see how it works for yourself. But be warned, my forked script code is a mess, as I’m a poor coder at best.

Last edited by Sunyata; 11-27-2023 at 09:34.
Sunyata is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 12-16-2023 , 11:23   Re: [L4D] Help needed with a panel menu
Reply With Quote #10

Hello 101,

Further to my previous requests in post 9, I've taken the initiative to modify your above script by incorporating my suggestions and tailoring it for my L4D server. The modifications now encompass the following:

1. Integrated three custom-made menu panels - with specific texts to suit my server.

2. Introduced a new 40-second timer for the commencement of hint (glance) menus when a player connects to the server.

3. Included a 2-second display-timer for each hint menu, with a 2-second interval timer between the menus - all three menus are glanceable for 6 seconds total.

4. Changed the double-tap function on the USE key with the TAB key and kept the longer cycle time for each menu to display for 25 seconds.

5. Added a '!help' chat command for the first menu [0] (on my server this is solely for chat commands).

I have only shared my version of the script here to provide you with the option to test its functionality firsthand if you so wish to do so.

The forked code I've employed is convoluted, and not very well optimized. I believe you could vastly improve it, 101. However, my version is only a quick fix, basically to suit my gaming needs. Whether you choose to enhance your original script further is entirely up to you. If not, I would recommend releasing your original script to the 'SM plugins' forum for other community members to have access to it - as your original version is already well-crafted in my view.
Attached Files
File Type: sp Get Plugin or Get Source (Commands_Instructions_3_Panel_Menus_Version_2.sp - 34 views - 6.0 KB)

Last edited by Sunyata; 12-16-2023 at 11:37. Reason: amended script slightly
Sunyata 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 16:43.


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