Raised This Month: $ Target: $400
 0% 

Big Doubt


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BolliN
Veteran Member
Join Date: Sep 2009
Location: In your Mind
Old 02-07-2010 , 16:26   Big Doubt
Reply With Quote #1

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(PLUGINVERSIONAUTHOR)
    
    
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 
0LISTA_ANIMALESi++) 
    {
        
formatex(Animalescharsmax(Animales), "Animal %d: \y%s\w!"iRank[i])
        
num_to_str(iPosicioncharsmax(Posicion)) 
        
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:
    {
        
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.
BolliN is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 02-07-2010 , 20:25   Re: Big Doubt
Reply With Quote #2

Try this.. I hope help you
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(PLUGINVERSIONAUTHOR)
    
    
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 
0LISTA_ANIMALESi++)
    {
        
formatex(Animalescharsmax(Animales), "Animal %d: \y%s\w!"iRank[i])
        
num_to_str(iPosicioncharsmax(Posicion))
        
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:
        {
            
RenameFiles("Cerdo")
        }
        case 
2:
        {
            
RenameFiles("Pajaro")
        }
        
// bla bla
        //You have to send to the function the file that will change his name to "El..."
    
}
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


public 
RenameFiles(const File[ ]) 
{
    new 
CurrFile[32] = "El"
    
for (new 0i<=LISTA_ANIMALESi++) {
        if (
contain(FileRank[i]) == -1) {
            
CurrFile "El"
            
format(CurrFile31"%s"Rank[i])
            
rename_file(CurrFileRank[i])
        }
        else {
            
CurrFile "El"
            
format(CurrFile31"%s"File)
            
rename_file(FileCurrFile)
        }
    }

Mxnn is offline
BolliN
Veteran Member
Join Date: Sep 2009
Location: In your Mind
Old 02-07-2010 , 21:02   Re: Big Doubt
Reply With Quote #3

if the file is in /addons/amxmod/config
i just add it?
PHP Code:
RenameFiles("/addons/amxmod/config/Cerdo"
when someon select case 2 it will rename Cerdo to, "ElCerdo"?

and when i choose for example, case 1(Cerdo rename to ElCerdo). And later select case 2 (Pajaro rename to ElPajaro) tThe previous one MUST rename to "Cerdo" (in this case), and "Pajaro" MUST rename to "ElPajaro". if you dont understan i will try to explain it again


Thnxs i will try it ;)

Last edited by BolliN; 02-07-2010 at 21:06.
BolliN is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 02-07-2010 , 21:32   Re: Big Doubt
Reply With Quote #4

Yes, the plugin do that..
To change the dir of the configs change it on the names in Rank[LISTA_ANIMALES]..
Instead of "cerdo" put "/addons/amxmodx/configs/cerdo.cfg"
Mxnn is offline
BolliN
Veteran Member
Join Date: Sep 2009
Location: In your Mind
Old 02-07-2010 , 21:48   Re: Big Doubt
Reply With Quote #5

Quote:
Originally Posted by Mxnn View Post
Yes, the plugin do that..
To change the dir of the configs change it on the names in Rank[LISTA_ANIMALES]..
Instead of "cerdo" put "/addons/amxmodx/configs/cerdo.cfg"
Ok, thanks see the PM i sent you ;)
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:25.


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