View Single Post
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 09-24-2022 , 10:18   Re: [L4D2] Admiral Menu - A Simplified VIP Menu (1.0) | 09/24/2022
Reply With Quote #4

Quote:
Originally Posted by Earendil View Post
Data files can be created using KeyValues. I made a plugin that uses a config file with KeyValues to save/load the spawn position and settings of entities, https://forums.alliedmods.net/showthread.php?p=2750321, take a look on it.

KeyValues API reference.
thanks Earendil, u r always great help to me, I will give that a look

for now, if anyone wanted to add external commands, 2 steps are needed:

1- you go to the original script, and search for "Create_CommandsMenu", you will notice multiple CMDs, like CMD1, CMD2 etc, near each CMD, "NONE" > add the name of your command you want players to see, so it should be looking like this:
PHP Code:
void Create_CommandsMenu(int client)
{
    
Menu menu = new Menu(Handle_CommandsMenu);
    
menu.SetTitle("Server Commands:");
    
menu.AddItem("CMD1""!admins - Online Admins");
    
menu.AddItem("CMD2""!buy - Buy Stuff");
    
menu.AddItem("CMD3""!lmc - Change Your Model");
    
menu.AddItem("CMD4""None");
    
menu.AddItem("CMD5""None");
    
menu.AddItem("CMD6""None");
    
menu.AddItem("CMD7""None");
    
menu.ExitBackButton true;
    
menu.Display(clientMENU_TIME_FOREVER);

2- the last thing, you need to go to "Handle_CommandsMenu", you need here to add the command related to each item you added, for example in the previous exampled, we added "!buy" for "CMD2", so in the "Handle_CommandsMenu", you go to the CMD2, and add the command itself, in this way FakeClientCommand(param1, "sm_buy"); Here is how it should look like:
PHP Code:
int Handle_CommandsMenu(Menu menuMenuAction actionint param1int param2)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            
char item[64];
            
menu.GetItem(param2itemsizeof(item));
            
menu.DisplayAt(param1GetMenuSelectionPosition(), MENU_TIME_FOREVER);
            
            if         (
StrEqual(item"CMD1")) FakeClientCommand(param1"sm_admins");
            else if (
StrEqual(item"CMD2")) FakeClientCommand(param1"sm_buy");
            else if (
StrEqual(item"CMD3")) FakeClientCommand(param1"sm_lmc");
            else if (
StrEqual(item"CMD4")) PrintToChat(param1"Not Applicable");
            else if (
StrEqual(item"CMD5")) PrintToChat(param1"Not Applicable");
            else if (
StrEqual(item"CMD6")) PrintToChat(param1"Not Applicable");
            else if (
StrEqual(item"CMD7")) PrintToChat(param1"Not Applicable");
        }
        case 
MenuAction_Cancel:
        {
            if (
param2 == MenuCancel_ExitBack
            {
                
Create_AdmiralMenu(param1);
            }
        }
    }
    return 
0;

__________________
alasfourom is offline