Raised This Month: $ Target: $400
 0% 

bool problem in menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-06-2010 , 16:16   bool problem in menu
Reply With Quote #1

PHP Code:
public Pistol_MainMenuiClient )
{
    if(!
b_HasMenu iClient ] )
    {
        
client_print(iClientprint_center"%s menu already enabled"PREFIX);
    }
    else
    {
        
client_print(iClientprint_center"%s menu enabled"PREFIX);
    }
        
    new 
title[75]; formatex(titlecharsmax(title), "\r%s \y- Weapon Menu"PREFIX );
    new 
menu menu_create(title"Pistol_Handle" );
    
    
menu_additem(menu"\wDeagle""1"0);
    
menu_additem(menu"\wUSP""2"0);
    
menu_additem(menu"\wGlock""3"0);
    
menu_additem(menu"\wFiveseven""4"0);
    
menu_addblank(menu1);
    
menu_addblank(menu1);
    
menu_addblank(menu1);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(iClientmenu0);

}

public 
Pistol_Handle(iClientmenuitem)
{
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            
give_item(iClient,"weapon_deagle"
        }
        case 
2:
        {
            
give_item(iClient,"weapon_usp"
        }
        case 
3:
        {
            
give_item(iClient,"weapon_glock"
        }
        case 
4:
        {
            
give_item(iClient,"weapon_fiveseven"
        }
    }
    return 
PLUGIN_HANDLED;

__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-06-2010 , 16:22   Re: bool problem in menu
Reply With Quote #2

You did not say anything that was wrong or what you needed help with.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-06-2010 , 16:41   Re: bool problem in menu
Reply With Quote #3

you should only be able to show this menu once per round
__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
Old 10-06-2010, 17:00
lucas_7_94
This message has been deleted by lucas_7_94. Reason: i understand bad.
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-06-2010 , 17:22   Re: bool problem in menu
Reply With Quote #4

Quote:
Originally Posted by lucas_7_94 View Post
Code:
new g_enabledmenu[33] public yourfuncion(id) {          g_enabledmenu[id]++          // you code here or idea }

No. Just stop trying to help because you don't know what you're talking about.

@Afro-Ankan
Change this:
Code:
    if(!b_HasMenu [ iClient ] )     {         client_print(iClient, print_center, "%s menu already enabled", PREFIX);     }
To this:
Code:
    if(!b_HasMenu [ iClient ] )     {         client_print(iClient, print_center, "%s menu already enabled", PREFIX);         return;     }
And put this in the end of the menu handler:
Code:
b_HasMenu[ iClient ] = false;
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 10-06-2010 , 17:26   Re: bool problem in menu
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
No. Just stop trying to help because you don't know what you're talking about.

@Afro-Ankan
Change this:
Code:
if(!b_HasMenu [ iClient ] ) { client_print(iClient, print_center, "%s menu already enabled", PREFIX); }

To this:
Code:
if(!b_HasMenu [ iClient ] ) { client_print(iClient, print_center, "%s menu already enabled", PREFIX); return; }

And put this in the end of the menu handler:
Code:
b_HasMenu[ iClient ] = false;
sorry , sorry , i understand bad.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-06-2010 , 17:40   Re: bool problem in menu
Reply With Quote #6

thanks exolent!
__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-06-2010 , 17:52   Re: bool problem in menu
Reply With Quote #7

when i spawn or connect it says "menu already enabled"
__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-06-2010 , 18:15   Re: bool problem in menu
Reply With Quote #8

Quote:
Originally Posted by Afro-Ankan View Post
when i spawn or connect it says "menu already enabled"
Set the bool to true on client connect.
__________________
fysiks is offline
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-07-2010 , 07:22   Re: bool problem in menu
Reply With Quote #9

same problem..


PHP Code:
public Pistol_MainMenuiClient /*client_print(iClient, print_center, "%s menu%s enabled", PREFIX, b_HasMenu[iClient] ? "" : "already" );*/
{
    
    if(!
b_HasMenu iClient ] )
    {
        
client_print(iClientprint_center"%s menu already enabled"PREFIX);
        return;
    }
    
    new 
title[75]; formatex(titlecharsmax(title), "\r%s \y- Weapon Menu"PREFIX );
    new 
menu menu_create(title"Pistol_Handle" );
    
    
menu_additem(menu"\wDeagle""1"0);
    
menu_additem(menu"\wUSP""2"0);
    
menu_additem(menu"\wGlock""3"0);
    
menu_additem(menu"\wFiveseven""4"0);
    
menu_addblank(menu1);
    
menu_addblank(menu1);
    
menu_addblank(menu1);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(iClientmenu0);
}

public 
Pistol_Handle(iClientmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            
give_item(iClient,"weapon_deagle"
        }
        case 
2:
        {
            
give_item(iClient,"weapon_usp"
        }
        case 
3:
        {
            
give_item(iClient,"weapon_glock"
        }
        case 
4:
        {
            
give_item(iClient,"weapon_fiveseven"
        }
    }
    
b_HasMenuiClient ] = true;
    return 
PLUGIN_HANDLED;

__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-07-2010 , 14:00   Re: bool problem in menu
Reply With Quote #10

Quote:
Originally Posted by Exolent[jNr] View Post
And put this in the end of the menu handler:
Code:
b_HasMenu[ iClient ] = false;
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 10:16.


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