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

Menu help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hamza47sohail
Senior Member
Join Date: Jan 2014
Old 02-19-2014 , 10:15   Menu help.
Reply With Quote #1

Hi.
Is it possible to have it so that you make a menu and there is or are commands that are useable only once?
So in the menu after using it once that options goes white (un clickable) or just disappears.
But re-adds or makes it clickable again on round restart.
__________________
The Server Is In CANADA GameTracker Is Being Weird
hamza47sohail is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-20-2014 , 16:52   Re: Menu help.
Reply With Quote #2

After round restart, they need open that menu again, to refresh menu.
PHP Code:
#include <sdktools>

public OnPluginStart()
{
    
RegConsoleCmd("sm_menu"command_menu);
    
HookEvent("round_start"round_start);
}

new 
bool:g_option_disabled[MAXPLAYERS+1];

public 
Action:command_menu(clientargs)
{
    if(
client == || !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }

    new 
Handle:menu CreateMenu(menu_handler);
    
SetMenuTitle(menu"my menu");
    
g_option_disabled[client] ? AddMenuItem(menu"""option 1"ITEMDRAW_DISABLED):AddMenuItem(menu"""option 1");
    
DisplayMenu(menuclientMENU_TIME_FOREVER);

    return 
Plugin_Handled;
}

public 
menu_handler(Handle:menuMenuAction:actionparam1param2)
{
    switch(
action)
    {
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }

        case 
MenuAction_Select:
        {
            if(
param2 == 0// First menu option
            
{
                
g_option_disabled[param1] = true;
                
command_menu(param10);
            }
        }
    }
}

public 
round_start(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new 
1<= MaxClientsi++)
    {
        
g_option_disabled[i] = false;
    }

Bacardi is offline
hamza47sohail
Senior Member
Join Date: Jan 2014
Old 02-20-2014 , 17:52   Re: Menu help.
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
After round restart, they need open that menu again, to refresh menu.
PHP Code:
#include <sdktools>

public OnPluginStart()
{
    
RegConsoleCmd("sm_menu"command_menu);
    
HookEvent("round_start"round_start);
}

new 
bool:g_option_disabled[MAXPLAYERS+1];

public 
Action:command_menu(clientargs)
{
    if(
client == || !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }

    new 
Handle:menu CreateMenu(menu_handler);
    
SetMenuTitle(menu"my menu");
    
g_option_disabled[client] ? AddMenuItem(menu"""option 1"ITEMDRAW_DISABLED):AddMenuItem(menu"""option 1");
    
DisplayMenu(menuclientMENU_TIME_FOREVER);

    return 
Plugin_Handled;
}

public 
menu_handler(Handle:menuMenuAction:actionparam1param2)
{
    switch(
action)
    {
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }

        case 
MenuAction_Select:
        {
            if(
param2 == 0// First menu option
            
{
                
g_option_disabled[param1] = true;
                
command_menu(param10);
            }
        }
    }
}

public 
round_start(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new 
1<= MaxClientsi++)
    {
        
g_option_disabled[i] = false;
    }

So can you tell me whats happening in your code?
If I press option 1 it will be disabled till round restart right?
Or something else. Just kinda confused, new to coding.
__________________
The Server Is In CANADA GameTracker Is Being Weird
hamza47sohail 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 12:03.


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