Member
|
04-20-2013
, 20:24
Re: [Ayuda] Quitar opcion al menu de el zp y agregar nueva opcion
|
#4
|
Quote:
Originally Posted by 3MCy Daimont
Supongamos que esta es la estructura de tu menu y handler (zp advance), compara los 2 y veras que no es nada complicado.
PHP Code:
// Game Menu
show_menu_game(id)
{
static menu[250], len, userflags
len = 0
userflags = get_user_flags(id)
// Title
len += formatex(menu[len], charsmax(menu) - len, "\y%s^n^n", g_modname)
// 1. Buy weapons
if (get_pcvar_num(cvar_buycustom))
len += formatex(menu[len], charsmax(menu) - len, "\r1.\w %L^n", id, "MENU_BUY")
else
len += formatex(menu[len], charsmax(menu) - len, "\d1. %L^n", id, "MENU_BUY")
// 2. Extra items
if (get_pcvar_num(cvar_extraitems) && g_isalive[id])
len += formatex(menu[len], charsmax(menu) - len, "\r2.\w %L^n", id, "MENU_EXTRABUY")
else
len += formatex(menu[len], charsmax(menu) - len, "\d2. %L^n", id, "MENU_EXTRABUY")
// 3. Zombie class
if (get_pcvar_num(cvar_zclasses))
len += formatex(menu[len], charsmax(menu) - len, "\r3.\w %L^n", id,"MENU_ZCLASS")
else
len += formatex(menu[len], charsmax(menu) - len, "\d3. %L^n", id,"MENU_ZCLASS")
// 4. Unstuck
if (g_isalive[id])
len += formatex(menu[len], charsmax(menu) - len, "\r4.\w %L^n", id, "MENU_UNSTUCK")
else
len += formatex(menu[len], charsmax(menu) - len, "\d4. %L^n", id, "MENU_UNSTUCK")
// 5. Help
len += formatex(menu[len], charsmax(menu) - len, "\r5.\w %L^n^n", id, "MENU_INFO")
// 6. Join spec
if (!g_isalive[id] || !get_pcvar_num(cvar_blocksuicide) || (userflags & g_access_flag[ACCESS_ADMIN_MENU]))
len += formatex(menu[len], charsmax(menu) - len, "\r6.\w %L^n^n", id, "MENU_SPECTATOR")
else
len += formatex(menu[len], charsmax(menu) - len, "\d6. %L^n^n", id, "MENU_SPECTATOR")
// 9. Admin menu
if (userflags & g_access_flag[ACCESS_ADMIN_MENU3])
len += formatex(menu[len], charsmax(menu) - len, "\r9.\w %L", id, "MENU3_ADMIN")
else
len += formatex(menu[len], charsmax(menu) - len, "\d9. %L", id, "MENU3_ADMIN")
// 0. Exit
len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Game Menu")
}
// Game Menu
public menu_game(id, key)
{
switch (key)
{
case 0: // Buy Weapons
{
// Custom buy menus enabled?
if (get_pcvar_num(cvar_buycustom))
{
// Disable the remember selection setting
WPN_AUTO_ON = 0
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "BUY_ENABLED")
// Show menu if player hasn't yet bought anything
if (g_canbuy[id]) show_menu_buy1(id)
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
}
case 1: // Extra Items
{
// Extra items enabled?
if (get_pcvar_num(cvar_extraitems))
{
// Check whether the player is able to buy anything
if (g_isalive[id])
show_menu_extras(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_EXTRAS")
}
case 2: // Zombie Classes
{
// Zombie classes enabled?
if (get_pcvar_num(cvar_zclasses))
show_menu_zclass(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ZCLASSES")
}
case 3: // Unstuck
{
// Check if player is stuck
if (g_isalive[id])
{
if (is_player_stuck(id))
{
// Move to an initial spawn
if (get_pcvar_num(cvar_randspawn))
do_random_spawn(id) // random spawn (including CSDM)
else
do_random_spawn(id, 1) // regular spawn
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_STUCK")
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
}
case 4: // Help Menu
{
show_menu_info(id)
}
case 5: // Join Spectator
{
// Player alive?
if (g_isalive[id])
{
// Prevent abuse by non-admins if block suicide setting is enabled
if (get_pcvar_num(cvar_blocksuicide) && !(get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU]))
{
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
return PLUGIN_HANDLED;
}
// Check that we still have both humans and zombies to keep the round going
check_round(id)
// Kill him before he switches team
dllfunc(DLLFunc_ClientKill, id)
}
// Temporarily save player stats?
if (get_pcvar_num(cvar_statssave)) save_stats(id)
// Remove previous tasks
remove_task(id+TASK_TEAM)
remove_task(id+TASK_MODEL)
remove_task(id+TASK_FLASH)
remove_task(id+TASK_CHARGE)
remove_task(id+TASK_SPAWN)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
// Then move him to the spectator team
fm_cs_set_user_team(id, FM_CS_TEAM_SPECTATOR)
fm_user_team_update(id)
}
case 8: // Admin Menu
{
// Check if player has the required access
if (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU3])
show_menu3_admin(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ACCESS")
}
}
return PLUGIN_HANDLED;
}
Lo Modificas y quedaria asi como tu lo pediste
PHP Code:
// Game Menu
show_menu_game(id)
{
static menu[250], len, userflags
len = 0
userflags = get_user_flags(id)
// Title
len += formatex(menu[len], charsmax(menu) - len, "\y%s^n^n", g_modname)
// 1. Buy weapons
if (get_pcvar_num(cvar_buycustom))
len += formatex(menu[len], charsmax(menu) - len, "\r1.\w %L^n", id, "MENU_BUY")
else
len += formatex(menu[len], charsmax(menu) - len, "\d1. %L^n", id, "MENU_BUY")
// 2. Extra items
if (get_pcvar_num(cvar_extraitems) && g_isalive[id])
len += formatex(menu[len], charsmax(menu) - len, "\r2.\w %L^n", id, "MENU_EXTRABUY")
else
len += formatex(menu[len], charsmax(menu) - len, "\d2. %L^n", id, "MENU_EXTRABUY")
// 3. Zombie class
if (get_pcvar_num(cvar_zclasses))
len += formatex(menu[len], charsmax(menu) - len, "\r3.\w %L^n", id,"MENU_ZCLASS")
else
len += formatex(menu[len], charsmax(menu) - len, "\d3. %L^n", id,"MENU_ZCLASS")
// 4. Unstuck
if (g_isalive[id])
len += formatex(menu[len], charsmax(menu) - len, "\r4.\w %L^n", id, "MENU_UNSTUCK")
else
len += formatex(menu[len], charsmax(menu) - len, "\d4. %L^n", id, "MENU_UNSTUCK")
// 5. Help
len += formatex(menu[len], charsmax(menu) - len, "\r5.\w Comprar \r Admin")
// 6. Join spec
if (!g_isalive[id] || !get_pcvar_num(cvar_blocksuicide) || (userflags & g_access_flag[ACCESS_ADMIN_MENU]))
len += formatex(menu[len], charsmax(menu) - len, "\r6.\w %L^n^n", id, "MENU_SPECTATOR")
else
len += formatex(menu[len], charsmax(menu) - len, "\d6. %L^n^n", id, "MENU_SPECTATOR")
// 9. Admin menu
if (userflags & g_access_flag[ACCESS_ADMIN_MENU3])
len += formatex(menu[len], charsmax(menu) - len, "\r9.\w %L", id, "MENU3_ADMIN")
else
len += formatex(menu[len], charsmax(menu) - len, "\d9. %L", id, "MENU3_ADMIN")
// 0. Exit
len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Game Menu")
}
// Game Menu
public menu_game(id, key)
{
switch (key)
{
case 0: // Buy Weapons
{
// Custom buy menus enabled?
if (get_pcvar_num(cvar_buycustom))
{
// Disable the remember selection setting
WPN_AUTO_ON = 0
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "BUY_ENABLED")
// Show menu if player hasn't yet bought anything
if (g_canbuy[id]) show_menu_buy1(id)
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
}
case 1: // Extra Items
{
// Extra items enabled?
if (get_pcvar_num(cvar_extraitems))
{
// Check whether the player is able to buy anything
if (g_isalive[id])
show_menu_extras(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_EXTRAS")
}
case 2: // Zombie Classes
{
// Zombie classes enabled?
if (get_pcvar_num(cvar_zclasses))
show_menu_zclass(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ZCLASSES")
}
case 3: // Unstuck
{
// Check if player is stuck
if (g_isalive[id])
{
if (is_player_stuck(id))
{
// Move to an initial spawn
if (get_pcvar_num(cvar_randspawn))
do_random_spawn(id) // random spawn (including CSDM)
else
do_random_spawn(id, 1) // regular spawn
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_STUCK")
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
}
case 4: // Help Menu
{
comprar_admin(id)
}
case 5: // Join Spectator
{
// Player alive?
if (g_isalive[id])
{
// Prevent abuse by non-admins if block suicide setting is enabled
if (get_pcvar_num(cvar_blocksuicide) && !(get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU]))
{
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")
return PLUGIN_HANDLED;
}
// Check that we still have both humans and zombies to keep the round going
check_round(id)
// Kill him before he switches team
dllfunc(DLLFunc_ClientKill, id)
}
// Temporarily save player stats?
if (get_pcvar_num(cvar_statssave)) save_stats(id)
// Remove previous tasks
remove_task(id+TASK_TEAM)
remove_task(id+TASK_MODEL)
remove_task(id+TASK_FLASH)
remove_task(id+TASK_CHARGE)
remove_task(id+TASK_SPAWN)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
// Then move him to the spectator team
fm_cs_set_user_team(id, FM_CS_TEAM_SPECTATOR)
fm_user_team_update(id)
}
case 8: // Admin Menu
{
// Check if player has the required access
if (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU3])
show_menu3_admin(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ACCESS")
}
}
return PLUGIN_HANDLED;
}
public comprar_admin(id)
{
show_motd(id, "comprar_admin.txt", "comprar_admin")
return PLUGIN_HANDLED
}
-Luego tienes que crear un archivo con extension .txt en este caso comprar_admin.txt y ponerlo en la carpeta cstrike, ovbiamente debes saber un poco de html para poder hacer espacios y no aparesca todo junto.
|
cuando compilo me dice esto:
<3533> : warning 217: loose identation
<3536> : warning 217: loose identation
lo compila pero cuando entro el menu 5 esta pegado arriba del 6, creo que le falta como una separacion.. pero nose como se hace?..
edit: ya aregle para que se vea bien, pero los errores al compilar siguen estando.. que puedo hacer?
Last edited by lanproject; 04-20-2013 at 22:49.
Reason: aregle uno de los errores.
|
|