Raised This Month: $ Target: $400
 0% 

as could optimize this?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
EclipseCP
BANNED
Join Date: Dec 2010
Old 04-08-2011 , 18:34   as could optimize this?
Reply With Quote #1

hi all, I have made ​​a counter for ADMINS sometimes send a number of ways (zombie plague), but not optimized, and to create a number of variables

PHP Code:
new g_nemesis_count[33]
new 
g_ninja_count[33]
new 
g_surv_count[33]
new 
g_zombie_count[33]
new 
g_human_count[33]
new 
g_swarm_count[33]
new 
g_multi_count[33]
new 
g_plague_count[33]
new 
g_armagedon_count[33]
new 
g_synapsis_count[33
PHP Code:
public show_menu_admin_players(id)
{
    new 
menu[450], lenuserflags
    
static limit

    userflags 
get_user_flags(id)
    
    
// Title
    
len += formatex(menu[len], charsmax(menu) - len"\yConvert to...^n^n")
    
    
// 1. Humanize command
    
if (userflags & (g_access_flag[ACCESS_MODE_INFECTION] | g_access_flag[ACCESS_MAKE_HUMAN]))
    {
        
limit 2
        
        
if (g_human_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r1.\w Human \r[\w%d\r/\w%d\r]^n"limit g_human_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d1. Human \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
        
    
// 2. Zombiefy command
    
if (userflags & (g_access_flag[ACCESS_MODE_INFECTION] | g_access_flag[ACCESS_MAKE_ZOMBIE]))
    {
        
limit 2
        
        
if (g_zombie_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r2.\w Zombie \r[\w%d\r/\w%d\r]^n"limit g_zombie_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d2. Zombie \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }    
    
    
// 3. Nemesis command
    
if (userflags & (g_access_flag[ACCESS_MODE_NEMESIS] | g_access_flag[ACCESS_MAKE_NEMESIS]))
    {
        
limit get_pcvar_num(cvar_nemesis_count)
        
        if (
g_nemesis_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r3.\w Nemesis \r[\w%d\r/\w%d\r]^n"limit g_nemesis_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d3. Nemesis \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
    
    
// 4. Survivor command
    
if (userflags & (g_access_flag[ACCESS_MODE_SURVIVOR] | g_access_flag[ACCESS_MAKE_SURVIVOR]))
    {
        
limit 2
        
        
if (g_surv_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r4.\w Survivor \r[\w%d\r/\w%d\r]^n"limit g_surv_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d4. Survivor \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
        
    
// 5. Ninja command
    
if (userflags & (g_access_flag[ACCESS_MODE_NINJA] | g_access_flag[ACCESS_MAKE_NINJA]))
    {
        
limit 1
        
        
if (g_ninja_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r5.\w Ninja \r[\w%d\r/\w%d\r]^n"limit g_ninja_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d5. Ninja \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
        
    
// 0. Exit
    
len += formatex(menu[len], charsmax(menu) - len"^n\r0.\w %L"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Admin Players Menu")    
    

PHP Code:
public show_menu_admin_modes(id
{
    new 
menu[450], lenuserflags
    
static limit

    userflags 
get_user_flags(id)
    
    
// Title
    
len += formatex(menu[len], charsmax(menu) - len"\yMODE^n^n")
    
    
// 1. swarm command
    
if (userflags g_access_flag[ACCESS_MODE_SWARM])
    {
        
limit 2
        
        
if (g_swarm_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r1.\w swarm \r[\w%d\r/\w%d\r]^n"limit g_swarm_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d1. swarm \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
        
    
// 2. multi command
    
if (userflags g_access_flag[ACCESS_MODE_MULTI])
    {
        
limit 2
        
        
if (g_multi_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r2.\w multi \r[\w%d\r/\w%d\r]^n"limit g_multi_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d2. multi \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }    
    
    
// 3. plague command
    
if (userflags g_access_flag[ACCESS_MODE_PLAGUE])
    {
        
limit 2
        
        
if (g_plague_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r3.\w plague \r[\w%d\r/\w%d\r]^n"limit g_plague_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d3. plague \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
    
    
// 4. armagedon command
    
if (userflags g_access_flag[ACCESS_MODE_ARMAGEDON])
    {
        
limit 2
        
        
if (g_armagedon_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r4.\w armagedon \r[\w%d\r/\w%d\r]^n"limit g_armagedon_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d4. armagedon \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
        
    
// 5. synapsis command
    
if (userflags g_access_flag[ACCESS_MODE_SYNAPSIS])
    {
        
limit 1
        
        
if (g_synapsis_count[id] < limit)
        {
            
len += formatex(menu[len], charsmax(menu) - len"\r5.\w armagedon \r[\w%d\r/\w%d\r]^n"limit g_synapsis_count[id], limit)
        }
        else
        {
            
len += formatex(menu[len], charsmax(menu) - len"\d5. armagedon \r[\y0\r/\w%d\r]^n"limit)
        }
        
    }
        
    
// 0. Exit
    
len += formatex(menu[len], charsmax(menu) - len"^n\r0.\w %L"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Admin Modes Menu")     

variables when you send the high mode

grettings.
EclipseCP is offline
 


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 20:12.


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