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

Help with menu .


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Splot
Junior Member
Join Date: Nov 2011
Old 12-21-2011 , 09:05   Help with menu .
Reply With Quote #1

hi everyone,

PHP Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init() {
    
register_plugin("simplevote""1.0""author")    
    
register_clcmd("say /menu""startmenu")        
}
public 
startmenu(id) {  
    if (
is_user_admin(id)) 
        
set_task(0.1,"themenu"id)
    else 
        
client_print0print_chat"you cant use this command if ur not an admin. ");
}  

public 
themenu(id) { 
    new 
szText555 char ];    
    
    
formatexszTextcharsmaxszText ), "the menu:^n");

    new 
menu menu_createszText"sub_votemenu" );
    
    
formatexszTextcharsmaxszText ), "option #1");
    
menu_additemmenuszText"1");    
    
    
formatexszTextcharsmaxszText ), "option #2");    
    
menu_additemmenuszText"2");
    
    
formatexszTextcharsmaxszText ), "option #3");
    
menu_additemmenuszText"3");
    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );    
    
menu_displayidmenu);        
        
    return 
PLUGIN_CONTINUE;
            
}

public 
sub_votemenuidmenuitem ) {            
    if( 
item == MENU_EXIT ) {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
data], iName64 ], accesscallback;
    
menu_item_getinfomenuitemaccessdatacharsmaxdata ), iNamecharsmaxiName ), callback );
    
    new 
menuv str_to_num(data);
    new 
playername[32]
    
get_user_name(idplayername31)    
    
    switch(
menuv) {
        case 
1:client_print0print_chat"%s chose option #1"playername);
        case 
2:client_print0print_chat"%s chose option #2"playername);    
        case 
3:client_print0print_chat"%s chose option #3"playername);
        
    }
    return 
PLUGIN_HANDLED;        

i want to do when the admin type /menu its will open the menu for all players .
how can i do that ?
thx.

Last edited by Splot; 12-21-2011 at 09:08.
Splot is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 12-21-2011 , 10:24   Re: Help with menu .
Reply With Quote #2

Code:
menu_display( id, menu, 0 );

=>

Code:
new players[ 32 ], i get_players( players, i ) for( new x = 0; x < i; x ++ )      menu_display( players[ i ], menu, 0 )
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 12-21-2011 , 17:57   Re: Help with menu .
Reply With Quote #3

PHP Code:
if( get_user_flags index ) & ADMIN_KICK ) {
        new 
menu menu_create"Player Menu""warn_handler" )
        
        new 
pnumkey10 ], players32 ]
        
get_playersplayerspnum )
        
        for( new 
ipnumi++ ) {
            new 
tempid players]
            
            
get_user_name tempidszNamecharsmax szName ) )
            
num_to_str tempidkeycharsmax key ) )
            
            
menu_additemmenuszNamekey)
        }
        
menu_displayindexmenu )
        } else {
        
ColorChatindexGREEN"%s^x01 You have to be an admin to do this!"szPrefix )
    } 
This should work
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Splot
Junior Member
Join Date: Nov 2011
Old 12-25-2011 , 10:21   Re: Help with menu .
Reply With Quote #4

Quote:
Originally Posted by Backstabnoob View Post
Code:
menu_display( id, menu, 0 );


=>

Code:
new players[ 32 ], i get_players( players, i ) for( new x = 0; x < i; x ++ ) menu_display( players[ i ], menu, 0 )
its crash my server.

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
if( get_user_flags index ) & ADMIN_KICK ) {
        new 
menu menu_create"Player Menu""warn_handler" )
        
        new 
pnumkey10 ], players32 ]
        
get_playersplayerspnum )
        
        for( new 
ipnumi++ ) {
            new 
tempid players]
            
            
get_user_name tempidszNamecharsmax szName ) )
            
num_to_str tempidkeycharsmax key ) )
            
            
menu_additemmenuszNamekey)
        }
        
menu_displayindexmenu )
        } else {
        
ColorChatindexGREEN"%s^x01 You have to be an admin to do this!"szPrefix )
    } 
This should work
That's not what I meant.
Splot is offline
Splot
Junior Member
Join Date: Nov 2011
Old 12-25-2011 , 11:27   Re: Help with menu .
Reply With Quote #5

No matter, I fixed it.
PHP Code:
menu_displayidmenu); 
-------->
PHP Code:
    new pplayers[32], ppnumptempid;    
    
get_players(pplayersppnum"ch");

    for( new 
ii<ppnumi++ )
    {
        
ptempid pplayers[i]
        
menu_display(ptempidmenu0)
    } 
Splot 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 11:18.


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