Raised This Month: $ Target: $400
 0% 

[Pedido] Menu de armas de zp


  
 
 
Thread Tools Display Modes
Author Message
TuerKa
BANNED
Join Date: Jan 2013
Old 01-29-2013 , 14:29   [Pedido] Menu de armas de zp
#1

Buenas estuve mirando un menu de armas que habian hecho y queria ver como adaptarlo al menu del zp, despues de estar horas y horas leyendo y viendo como adaptar ese menu en mi zp y ver que tenia otro sistema para recordar y que me quedo todo mal quise tratar de poner para las del menu nuevo aparezcan en el menu viejo cosa que no pude hacer. alguien me ayuda a hacerlo?
dejo el menu normal y el nuevo

menu normal:

PHP Code:
public show_menu_buy1(taskid)
{
    
// Get player's id
    
static id
    
(taskid g_maxplayers) ? (id ID_SPAWN) : (id taskid);
    
    
// Zombies/Survivors/Snipers get no guns
    
if (!g_isalive[id] || g_zombie[id] || g_survivor[id] || g_sniper[id])
        return;
    
    
// Bots pick their weapons randomly / Random weapons setting enabled
    
if (get_pcvar_num(cvar_randweapons) || g_isbot[id])
    {
        
buy_primary_weapon(idrandom_num(0ArraySize(g_primary_items) - 1))
        
menu_buy2(idrandom_num(0ArraySize(g_secondary_items) - 1))
        return;
    }
    
    
// Automatic selection enabled for player and menu called on spawn event
    
if (WPN_AUTO_ON && taskid g_maxplayers)
    {
        
buy_primary_weapon(idWPN_AUTO_PRI)
        
menu_buy2(idWPN_AUTO_SEC)
        return;
    }
    
    static 
menu[300], lenweapmaxloops
    len 
0
    maxloops 
min(WPN_STARTID+7WPN_MAXIDS)
    
    
// Title
    
len += formatex(menu[len], charsmax(menu) - len"\y%L \r[%d-%d]^n^n"id"MENU_BUY1_TITLE"WPN_STARTID+1min(WPN_STARTID+7WPN_MAXIDS))
    
    
// 1-7. Weapon List
    
for (weap WPN_STARTIDweap maxloopsweap++)
        
len += formatex(menu[len], charsmax(menu) - len"\r%d.\w %s^n"weap-WPN_STARTID+1WEAPONNAMES[ArrayGetCell(g_primary_weaponidsweap)])
    
    
// 8. Auto Select
    
len += formatex(menu[len], charsmax(menu) - len"^n\r8.\w %L \y[%L]"id"MENU_AUTOSELECT"id, (WPN_AUTO_ON) ? "MOTD_ENABLED" "MOTD_DISABLED")
    
    
// 9. Next/Back - 0. Exit
    
len += formatex(menu[len], charsmax(menu) - len"^n^n\r9.\w %L/%L^n^n\r0.\w %L"id"MENU_NEXT"id"MENU_BACK"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Buy Menu 1")
}

// Buy Menu 1
public menu_buy1(idkey)
{
    
// Zombies/Survivors/Snipers get no guns
    
if (!g_isalive[id] || g_zombie[id] || g_survivor[id] || g_sniper[id])
        return 
PLUGIN_HANDLED;
    
    
// Special keys / weapon list exceeded
    
if (key >= MENU_KEY_AUTOSELECT || WPN_SELECTION >= WPN_MAXIDS)
    {
        switch (
key)
        {
            case 
MENU_KEY_AUTOSELECT// toggle auto select
            
{
                
WPN_AUTO_ON WPN_AUTO_ON
            
}
            case 
MENU_KEY_NEXT// next/back
            
{
                if (
WPN_STARTID+WPN_MAXIDS)
                    
WPN_STARTID += 7
                
else
                    
WPN_STARTID 0
            
}
            case 
MENU_KEY_EXIT// exit
            
{
                return 
PLUGIN_HANDLED;
            }
        }
        
        
// Show buy menu again
        
show_menu_buy1(id)
        return 
PLUGIN_HANDLED;
    }
    
    
// Store selected weapon id
    
WPN_AUTO_PRI WPN_SELECTION
    
    
// Buy primary weapon
    
buy_primary_weapon(idWPN_AUTO_PRI)
    
    
// Show pistols menu
    
show_menu_buy2(id)
    
    return 
PLUGIN_HANDLED;
}

// Buy Primary Weapon
buy_primary_weapon(idselection)
{
    
// Drop previous weapons
    
drop_weapons(id1)
    
drop_weapons(id2)
    
    
// Strip off from weapons
    
fm_strip_user_weapons(id)
    
fm_give_item(id"weapon_knife")
    
    
// Get weapon's id and name
    
static weaponidwname[32]
    
weaponid ArrayGetCell(g_primary_weaponidsselection)
    
ArrayGetString(g_primary_itemsselectionwnamecharsmax(wname))
    
    
// Give the new weapon and full ammo
    
fm_give_item(idwname)
    
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
    
    
// Weapons bought
    
g_canbuy[id] = false
    
    
// Give additional items
    
static i
    
for (0ArraySize(g_additional_items); i++)
    {
        
ArrayGetString(g_additional_itemsiwnamecharsmax(wname))
        
fm_give_item(idwname)
    }

y el menu nuevo:

PHP Code:
public show_menu_armas(taskid page
{     
    new 
id ID_SPAWN 
     
    
new len[999] , temp[22]

    
// Zombies, survivors or snipers get no guns
    
if (!g_isalive[id] || g_zombie[id] || g_survivor[id] || g_sniper[id] || g_l4dround)
        return 
PLUGIN_HANDLED;
     
    if(
can_buy(id)) // es para chequear algunas condiciones 
        
return PLUGIN_HANDLED 
     
    menu_armas 
menu_create("\r[\yArmas Primarias\r]" "handler_primarias"
     
    if(
g_save_weapons[id][0]) // Si Tiene Su Auto-Seleccion 
    

        if(
g_save_weapons[id][1] != -1// No es igual a -1 por lo de arriba 
        

            
handler_primarias(id menu_armas g_save_weapons[id][1]) 
            return 
PLUGIN_HANDLED 
        

    } 
     
    for(new 
sizeof menu_death i++) 
    { 
        if(
g_level[id] >= menu_death[i][item_level]) 
            
formatex(len charsmax(len) , "\w%s \y[Disponible]" menu_death[i][item_name_v2]) 
        else 
            
formatex(len charsmax(len) , "\d%s \r[\yNivel: \w%d\r]" menu_death[i][item_name_v2] , menu_death[i][item_level]) 

        
num_to_str(i,temp2
        
menu_additem(menu_armas len temp
    } 
     
    
menu_setprop(menu_armas MPROP_BACKNAME,"\wAtras"
    
menu_setprop(menu_armas MPROP_NEXTNAME,"\wSiguiente"
    
menu_setprop(menu_armas MPROP_EXITNAME,"\wSalir"
    
menu_display(idmenu_armas page
     
    return 
PLUGIN_HANDLED 


public 
handler_primarias(id menu_armas item)

    if(
item == MENU_EXIT || !is_user_alive(id)) 
    { 
        
menu_destroy(menu_armas
        return 
PLUGIN_HANDLED 
    

     
    if(
can_buy(id)) 
        return 
PLUGIN_HANDLED 
         
    
new page armas_2
    player_menu_info
(id menu_armasarmas_2 page)

    
// Zombies, survivors or snipers get no guns
    
if (!g_isalive[id] || g_zombie[id] || g_survivor[id] || g_sniper[id])
        return 
PLUGIN_HANDLED;
     
    if(
g_level[id] >= menu_death[item][item_level]) // Nivel igual o mayor al requerido
    

        
g_arma_prim[id] = item // guardamos el item en esta variable 
        
g_save_weapons[id][1] = item // guardamos el item en este variable 
        
drop_weapons(id 1// le botamos su arma primaria 
        
fm_give_item(id menu_death[item][item_csname]) // le damos el item 
        
ExecuteHamB(Ham_GiveAmmoidMAXBPAMMO[menu_death[item][item_id]], AMMOTYPE[menu_death[item][item_id]], MAXBPAMMO[menu_death[item][item_id]]) 
        
g_canbuy[id] = false // para que no pueda volver a abrir el menu 

        
show_menu_buy3(id)
    } 
    else 
    { 
        
zp_colored_print(id "%s Necesitas ser nivel^x04 %d^x03 para elegir esta arma." TAG menu_death[item][item_level]) 
        
show_menu_armas(id+TASK_SPAWN page)
    } 
    return 
PLUGIN_HANDLED

si necesitan algo mas me dicen me esta volviendo loco esto.

Last edited by TuerKa; 01-29-2013 at 14:30.
TuerKa is offline
dalegato
Senior Member
Join Date: Feb 2011
Old 01-29-2013 , 16:06   Re: [Pedido] Menu de armas de zp
#2

Por que se les complica tanto hacer una tonteria, lo unico que tenes que cambiar es el loop de

public show_menu_buy1(taskid)

y

buy_primary_weapon(id, selection)

nada mas que eso.
dalegato is offline
TuerKa
BANNED
Join Date: Jan 2013
Old 01-29-2013 , 18:00   Re: [Pedido] Menu de armas de zp
#3

loop? me enseņas porfavor?
TuerKa is offline
 



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:04.


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