Raised This Month: $ Target: $400
 0% 

Toggle ON/OFF


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 12-23-2012 , 15:24   Re: Toggle ON/OFF
Reply With Quote #4

I never used new menu system. Example using old menu system:
PHP Code:
#include <amxmodx>
new bool:g_fun_mode

public plugin_init(){    
    
register_menucmd(register_menuid("\yFun Menu"), 1023"menu_handler")
    
register_clcmd("say /fun","Fun_Menu")
}

public 
Fun_Menu(id){
    new 
flags get_user_flags(id)
    new 
has_access =  flags & (g_fun_mode?ADMIN_IMMUNITY:SUPER_ADMIN_FLAG)
    new 
super_admin flags SUPER_ADMIN_FLAG
    
    
new poscache[512], keys = (1<<9)
    if(
super_admin)
        
keys |= 1<<2
    
if(has_access)
        
keys |= (1<<0)|(1<<1)
        
    
pos += formatex(cache[pos], sizeof(cache)-1-pos"\yFun Menu^n")
    
pos += formatex(cache[pos], sizeof(cache)-1-pos"%s1. Option 1^n"has_access?"\w":"\d")
    
pos += formatex(cache[pos], sizeof(cache)-1-pos"%s2. Option 2^n"has_access?"\w":"\d")
    
pos += formatex(cache[pos], sizeof(cache)-1-pos"%s3. Fun Mode [ %s%s ]^n"super_admin?"\w":"\d"g_fun_mode?"\yON":"\rOFF"super_admin?"\w":"\d")
    
pos += formatex(cache[pos], sizeof(cache)-1-pos"^n\w0. Exit")
    
show_menu(idkeyscache, -1)
}

public 
menu_handler(idkeys){
    new 
flags get_user_flags(id)
    new 
has_access =  flags & (g_fun_mode?ADMIN_IMMUNITY:SUPER_ADMIN_FLAG)
    new 
super_admin flags SUPER_ADMIN_FLAG
    
    
switch(keys){
        case 
0: {
            if(
has_access){
                
client_print(idprint_chat"Selected option 1")
            }
        }
        case 
1: {        
            if(
has_access){
                
client_print(idprint_chat"Selected option 2")
            }
        }
        case 
2: {
            if(
super_admin){
                
g_fun_mode = !g_fun_mode
            
}
        }
        default: return
    }
    
Fun_Menu(id)

__________________
Impossible is Nothing

Last edited by Sylwester; 12-23-2012 at 15:24.
Sylwester is offline
 



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 13:41.


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