Can somebody help me to do this?
PHP Code:
#include <amxmodx>
#define PLUGIN "Menu con For"
#define AUTHOR "Kiske"
#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(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /menu", "MenuConFor")
register_clcmd("say_team /menu", "MenuConFor")
}
public MenuConFor(id)
{
new Animales[50], Posicion[10]
new menu = menu_create("\yLista de Animales", "MenuAnimales")
for(new i = 0; i < LISTA_ANIMALES; i++)
{
formatex(Animales, charsmax(Animales), "Animal %d: \y%s\w!", i, Rank[i])
num_to_str(i, Posicion, charsmax(Posicion))
menu_additem(menu, Animales, Posicion)
}
menu_setprop(menu, MPROP_NEXTNAME, "Pagina Siguiente")
menu_setprop(menu, MPROP_BACKNAME, "Pagina Anterior")
menu_setprop(menu, MPROP_EXITNAME, "Salir")
menu_display(id, menu, 0)
return PLUGIN_HANDLED;
}
public MenuAnimales(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
switch(str_to_num(data))
{
case 1:
{
rename_file("Cerdo", "ElCerdo", 1)
rename_file("ElPajaro", "Pajaro", 1)
rename_file("ElPinguino", "Pinguino", 1)
rename_file("ElElefante", "Elefante", 1)
rename_file("ElChancho", "Chancho", 1)
// and else.
}
case 2:
{
rename_file("ElCerdo", "Cerdo", 1)
rename_file("Pajaro", "ElPajaro", 1)
rename_file("ElPinguino", "Pinguino", 1)
rename_file("ElElefante", "Elefante", 1)
rename_file("ElChancho", "Chancho", 1)
//And else
//I want an easy way to write this in few lines
//As you can see its always the same factor, CERDO change to ELcerdo, in the second case PAJARO change to ELpajaro, etc.
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
//I want an easy way to write this in few lines
//As you can see its always the same factor, CERDO change to ELcerdo, in the second case PAJARO change to ELpajaro, etc.
Thnxs in advanced
PS: I want to do this with 20 cases, thats why i asked for this.