Raised This Month: $ Target: $400
 0% 

Have a problem with my menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BolliN
Veteran Member
Join Date: Sep 2009
Location: In your Mind
Old 02-08-2010 , 09:44   Have a problem with my menu
Reply With Quote #1

PHP Code:
#include <amxmodx>

#define PLUGIN "Menu Rebelde"
#define AUTHOR ";BolliN"
#define VERSION "1.0"

#define LISTA_ANIMALES 10 
new const Rank[LISTA_ANIMALES][] = { "Cerdo""Pajaro""Pinguino""Elefante""Chancho""Perro""Gato""Loro""Cacatua""Dinosaurio" 

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /menu""MenuConFor")
    
register_clcmd("say_team /menu""MenuConFor")
}

public 
MenuConFor(id)
{
    new 
Animales[50], Posicion[5
    new 
menu menu_create("\yLista de Animales""MenuAnimales")
    
    for(new 
0LISTA_ANIMALESi++) 
    {
        
formatex(Animalescharsmax(Animales), "Animal %d: \y%s\w!"iRank[i]) 
        
format(Posicioncharsmax(Posicion), "^"%d^""i+1)
        
menu_additem(menuAnimalesPosicion
    }
    
    
menu_setprop(menuMPROP_NEXTNAME"Pagina Siguiente"
    
menu_setprop(menuMPROP_BACKNAME"Pagina Anterior"
    
menu_setprop(menuMPROP_EXITNAME"Salir")
    
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED;
}
public 
MenuAnimales(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menuitemaccessdata5iName63callback)
    
    switch(
str_to_num(data))
    {
        case 
1
        {
            
server_cmd("sv_restart 1")
        }
        case 
2:
        {
            
server_cmd("sv_restart 1")
        }
        case 
3:
        {
            
server_cmd("sv_restart 1")
        }
        case 
4:
        {
            
server_cmd("sv_restart 1")
        }
        case 
5:
        {
            
server_cmd("sv_restart 1")
        }
        case 
6:
        {
            
server_cmd("sv_restart 1")
        }
        case 
7:
        {
            
server_cmd("sv_restart 1")
        }
        case 
8:
        {
            
server_cmd("sv_restart 1")
        }
        case 
9:
        {
            
server_cmd("sv_restart 1")

        }
        case 
10:
        {
            
server_cmd("sv_restart 1")

        }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED;
}

The menu i made, doesnt do the things i set in the cases. When i press case number 1 nothing happen :S
This is just an example..

Thanks
BolliN is offline
andregb8
Junior Member
Join Date: Jul 2009
Old 02-08-2010 , 13:06   Re: Have a problem with my menu
Reply With Quote #2

Replace
PHP Code:
format(Posicioncharsmax(Posicion), "^"%d^""i+1
With:
PHP Code:
num_to_str(i+1Posicioncharsmax(Posicion)) 
andregb8 is offline
BolliN
Veteran Member
Join Date: Sep 2009
Location: In your Mind
Old 02-08-2010 , 13:23   Re: Have a problem with my menu
Reply With Quote #3

it works thanks

One problem, the last option and the first option doesnt work because its start in 0
How can i fixed that?

Last edited by BolliN; 02-08-2010 at 13:44.
BolliN is offline
Old 02-08-2010, 15:48
Kaaba
This message has been deleted by Kaaba. Reason: nvm -.-
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-08-2010 , 19:19   Re: Have a problem with my menu
Reply With Quote #4

Quote:
Originally Posted by Kaaba View Post
use symbols, for example & % * or something like that
Wow, what are you talking about!?!

Quote:
Originally Posted by BolliN View Post
it works thanks

One problem, the last option and the first option doesnt work because its start in 0
How can i fixed that?
It wouldn't even compile. You need to close the switch statement before the menu_destroy(menu) and return PLUGIN_HANDLED.
__________________
fysiks is offline
BolliN
Veteran Member
Join Date: Sep 2009
Location: In your Mind
Old 02-08-2010 , 22:53   Re: Have a problem with my menu
Reply With Quote #5

, solved thanks
BolliN 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 07:21.


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