Raised This Month: $ Target: $400
 0% 

can optimize this menu?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SylvertCs
BANNED
Join Date: Sep 2009
Location: San Nicolas-Buenos Aires
Old 01-24-2010 , 21:49   can optimize this menu?
Reply With Quote #1

PHP Code:
new const precio_velocidad[] = {1,3,6,9,13,15,19,25,30,36,45,51,58,64,73,89,110,120,131,150}
new const 
restar_velocidad[] = {45,80,120,160,200}
new 
re_velocidad[33]
new 
pr_velocidad[33]


show_menu_velocidad(id)
{
    
    static 
menu[999], len
    len 
0
    
    
// Title
    
len += formatex(menu[len], charsmax(menu) - len"\wSpeed\y(\r%d \yOf \r20\y)^n^n\wPoints Available:\y%d^n^n",g_banco2[id],g_puntos_humanos[id])
    
    
// 1. Subir Puntos de Velocidad
    
if(pr_velocidad[id] < 20)
    {
        if(
g_puntos_humanos[id] >= precio_velocidad[pr_velocidad[id]])
            
len += formatex(menu[len], charsmax(menu) - len"\r1. \wUp 1 Point\r(\yCosto %d\r)^n",precio_velocidad[pr_velocidad[id]])
        else
            
len += formatex(menu[len], charsmax(menu) - len"\r1. \dUp 1 Point\r(\yCosto %d\r)^n",precio_velocidad[pr_velocidad[id]]) 
    }
    else if(
pr_velocidad[id] == 20)
    {
        
len += formatex(menu[len], charsmax(menu) - len"\r1. \wYou arrived at top speed^n"
    }
    
// 2. Restar Puntos de Velocidad
    
if(re_velocidad[id] < 20)
    {
        if(
g_ammopacks[id] >= restar_velocidad[re_velocidad[id]])
            
len += formatex(menu[len], charsmax(menu) - len"\r2. \wSubtract 1 point\r(\y%d AmmoPacks\r)^n^n",restar_velocidad[re_velocidad[id]])
        else
            
len += formatex(menu[len], charsmax(menu) - len"\r2. \dSubtract 1 point\r(\y%d AmmoPacks\r)^n^n",restar_velocidad[re_velocidad[id]])
    }
    else if(
re_velocidad[id] == 20)
    {
        
len += formatex(menu[len], charsmax(menu) - len"\r2. \wYou can not subtract more points for speed^n^n")
    }
    
// 0. Exit
    
len += formatex(menu[len], charsmax(menu) - len"^n^n\r0.\w %L"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Menu Velocidad")
}
public 
menu_velocidad(idkey)
{
    switch (
key)
    {
        case 
0:
        {
            if(
pr_velocidad[id] < 20)
            {
                if(
g_puntos_humanos[id] >= precio_velocidad[pr_velocidad[id]])
                {
                    
g_banco2[id]++
                    
pr_velocidad[id]++
                    
show_menu_velocidad(id)
                }
                else
                {
                    
show_menu_velocidad(id)
                    
zp_colored_print(id,"^x04[ZP]^x01 Do not have enough points of Humans")
                }
            }
            else if(
pr_velocidad[id] == 20)
            {
                
show_menu_velocidad(id)
                
zp_colored_print(id,"^x04[ZP]^x01 You arrived at top speed")
            }
        }
        case 
1:
        {
            if(
re_damage[id] < 5)
            {
                if(
g_ammopacks[id] >= restar_velocidad[re_velocidad[id]])
                {
                    if(
g_banco2[id] <= 0)
                    {
                        
show_menu_velocidad(id)
                        
zp_colored_print(id"^x04[ZP]^x01 Speed has no points to subtract")
                    }
                    else if (
g_banco2[id] >= 1)
                    {
                        
update_ap(id,-restar_velocidad[re_velocidad[id]],0)
                        
g_banco2[id]--
                        
g_puntos_humanos[id]++
                        
re_velocidad[id]++
                        
pr_velocidad[id]--
                        
show_menu_velocidad(id)
                    }
                }
                else
                {
                    
show_menu_velocidad(id)
                    
zp_colored_print(id"^x04[ZP]^x01 Not have enough AmmoPacks")
                }
            }
            else if(
re_damage[id] == 5)
            {
                
show_menu_velocidad(id)
                
zp_colored_print(id"^x04[ZP]^x01 You arrived at top speed")
            }
        }
    }
    
    return 
PLUGIN_HANDLED;

Sorry about my English xD

Last edited by SylvertCs; 01-24-2010 at 22:04.
SylvertCs is offline
Send a message via MSN to SylvertCs
 



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 07:17.


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