AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
|
06-24-2012
, 03:49
Ayuda no me funciona el menu
|
#1
|
Gente tengo un problema con dos menu , el de las classes humanas y el de zombies, supongamos que para elegir la clase de zombie tengo que apretar el 3, bueno lo apreto y no pasa nada , lo mismo con los humanos , si me podrian ayudar se los agradeceria mucho ;)
PHP Code:
// Game Menu
show_menu_game(id)
{
static menu[250], len
len = 0
// Title
len += formatex(menu[len], sizeof menu - 1 - len, "\y%s^n^n", g_modname)
// 1. Comprar Armas
if (get_pcvar_num(cvar_buycustom))
len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\r %L^n", id, "MENU_BUY")
else
len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_BUY")
// 2. Items extras
if (!g_survivor[id] && !g_nemesis[id] && get_pcvar_num(cvar_extraitems) && is_user_alive(id))
len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\y %L^n", id, "MENU_EXTRABUY")
else
len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n", id, "MENU_EXTRABUY")
// 3. Classes zm
if (get_pcvar_num(cvar_zclasses))
len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w Elegir Clase De \rZombie^n")
else
len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\d Elegir Clase De \rZombie^n")
// 4. Destrabar
if (is_user_alive(id))
len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\y %L^n", id, "MENU_UNSTUCK")
else
len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n", id, "MENU_UNSTUCK")
// 5-6. Ayuda and join spec
len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n^n\r6.\r %L^n^n", id, "MENU_INFO", id, "MENU_SPECTATOR")
// 7. Opciones
len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\r Opciones juego^n")
// 8. Classes zm
if (get_pcvar_num(cvar_hclasses))
len += formatex(menu[len], sizeof menu - 1 - len, "\r8.\w Elegir Clase De \rHumano^n^n")
else
len += formatex(menu[len], sizeof menu - 1 - len, "\r8.\d Elegir Clase De \rHumano^n^n")
// 9. Admin menu
if (get_user_flags(id) & ACCESS_FLAG)
len += formatex(menu[len], sizeof menu - 1 - len, "\r9.\r %L", id, "MENU_ADMIN")
else
len += formatex(menu[len], sizeof menu - 1 - len, "\d9. %L", id, "MENU_ADMIN")
// 0. Exit
len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\y %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))
{
WPN_AUTO_ON = 0
if (g_canbuy[id]) Show_Menu_Categoria(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 (is_user_alive(id) && !g_survivor[id] && !g_nemesis[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: // Menu Zombie Classes
{
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 (is_user_alive(id) && is_player_stuck(id))
{
// Spawn randomly / get back to base
if (get_pcvar_num(cvar_randspawn))
do_random_spawn(id)
else
dllfunc(DLLFunc_Spawn, id)
}
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_STUCK")
}
case 4: // Help Menu
{
// motd
show_menu_info(id)
}
case 5: // Join Spectator
{
// If alive
if (is_user_alive(id))
{
// 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)
// Then move him to the spectator team
fm_set_user_team(id, CS_TEAM_SPECTATOR)
fm_set_user_team_msg(id+TASK_TEAM)
}
case 6: // Opciones Menu
{
HookCmdMenu(id)
}
case 7: // Human Menu
{
// Human classes enabled?
if (get_pcvar_num(cvar_hclasses))
show_menu_hclass(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_HCLASSES")
}
case 8: // Admin Menu
{
// Check if player has the required access
if (get_user_flags(id) & ACCESS_FLAG)
show_menu_admin(id)
else
zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ACCESS")
}
}
return PLUGIN_HANDLED;
}
public show_menu_zclass(id)
{
// Player disconnected
if (!is_user_connected(id))
return;
// Bots pick their zombie class randomly
if (is_user_bot(id))
{
g_zombieclassnext[id] = random_num(0, g_zclass_i - 1)
return;
}
static menu[400], len, class
len = 0
// Title
len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r[%d-%d]^n^n", id, "MENU_ZCLASS_TITLE", ZCLASSES_STARTID+1, min(ZCLASSES_STARTID+7, g_zclass_i))
// 1-7. Class List
for (class = ZCLASSES_STARTID; class < min(ZCLASSES_STARTID+7, g_zclass_i); class++)
{
if (g_level[id] >= g_zclass_lvl[class] && g_reset[id] >= g_zclass_reset[class])
{
if (class == g_zombieclassnext[id])
len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s %s^n", class-ZCLASSES_STARTID+1, g_zclass_name[class], g_zclass_info[class])
else
len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s\y %s^n", class-ZCLASSES_STARTID+1, g_zclass_name[class], g_zclass_info[class])
}
else
len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\d %s %s\r (Nivel Requerido: %d)^n \r%d.\d %s %s\r (Reset Requerido: %d)^n", class-ZCLASSES_STARTID+1, g_zclass_name[class], g_zclass_info[class], g_zclass_lvl[class], g_zclass_reset[class])
}
// 8. Back - 9. Next - 0. Exit
len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Zombie Class Menu")
}
// Humam Class Menu
public show_menu_hclass(id)
{
// Player disconnected
if (!is_user_connected(id))
return;
// Bots pick their zombie class randomly
if (is_user_bot(id))
{
g_humanclassnext[id] = random_num(0, g_hclass_i - 1)
return;
}
static menu[400], len, class
len = 0
// Title
len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r[%d-%d]^n^n", id, "MENU_HCLASS_TITLE", HCLASSES_STARTID+1, min(HCLASSES_STARTID+7, g_hclass_i))
// 1-7. Class List
for (class = HCLASSES_STARTID; class < min(HCLASSES_STARTID+7, g_hclass_i); class++)
{
if (g_level[id] >= g_hclass_lvl[class] && g_reset[id] >= g_hclass_reset[class])
{
if (class == g_humanclassnext[id])
len += formatex(menu[len], sizeof menu - 1 - len, "\d%d. %s %s^n", class-HCLASSES_STARTID+1, g_hclass_name[class], g_hclass_info[class])
else
len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\w %s\y %s^n", class-HCLASSES_STARTID+1, g_hclass_name[class], g_hclass_info[class])
}
else
len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\d %s %s\r (Nivel Requerido: %d)^n \r%d.\d %s %s\r (Reset Requerido: %d)^n", class-HCLASSES_STARTID+1, g_hclass_name[class], g_hclass_info[class], g_hclass_lvl[class], g_hclass_reset[class])
}
// 8. Back - 9. Next - 0. Exit
len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Human Class Menu")
}
// Zombie Class Menu
public menu_zclass(id, key)
{
// Special keys / items list exceeded
if (key >= MENU_KEY_BACK || ZCLASSES_SELECTION >= g_zclass_i)
{
switch (key)
{
case MENU_KEY_BACK: // back
{
if (ZCLASSES_STARTID-7 >= 0) ZCLASSES_STARTID -= 7
}
case MENU_KEY_NEXT: // next
{
if (ZCLASSES_STARTID+7 < g_zclass_i) ZCLASSES_STARTID += 7
}
case MENU_KEY_EXIT: // exit
{
return PLUGIN_HANDLED;
}
}
// Show extra items menu again
show_menu_zclass(id)
return PLUGIN_HANDLED;
}
if (g_level[id] >= g_zclass_lvl[ZCLASSES_SELECTION] && g_reset[id] >= g_zclass_reset[ZCLASSES_SELECTION])
{
// Store selection for the next infection
g_zombieclassnext[id] = ZCLASSES_SELECTION;
// Show selected zombie class info and stats
zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "ZOMBIE_SELECT", g_zclass_name[g_zombieclassnext[id]])
zp_colored_print(id, "^x04[ZP]^x01 %L: %d %L: %d %L: %d %L: %d%%", id, "ZOMBIE_ATTRIB1", g_zclass_hp[g_zombieclassnext[id]], id, "ZOMBIE_ATTRIB2", g_zclass_spd[g_zombieclassnext[id]],
id, "ZOMBIE_ATTRIB3", floatround(g_zclass_grav[g_zombieclassnext[id]]*800), id, "ZOMBIE_ATTRIB4", floatround(g_zclass_kb[g_zombieclassnext[id]]*100))
}
else
{
zp_colored_print(id, "^x04[ZP]^x01 No tenes Nivel o reset suficiente para elegir esta Clase de Zombie. [Nivel Requerido: %d] [Reset Requerido: %d]", g_zclass_lvl[ZCLASSES_SELECTION], g_zclass_reset[ZCLASSES_SELECTION])
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
// Human Class Menu
public menu_hclass(id, key)
{
// Special keys / items list exceeded
if (key >= MENU_KEY_BACK || HCLASSES_SELECTION >= g_hclass_i)
{
switch (key)
{
case MENU_KEY_BACK: // back
{
if (HCLASSES_STARTID-7 >= 0) HCLASSES_STARTID -= 7
}
case MENU_KEY_NEXT: // next
{
if (HCLASSES_STARTID+7 < g_hclass_i) HCLASSES_STARTID += 7
}
case MENU_KEY_EXIT: // exit
{
return PLUGIN_HANDLED;
}
}
// Show extra items menu again
show_menu_hclass(id)
return PLUGIN_HANDLED;
}
if (g_level[id] >= g_hclass_lvl[HCLASSES_SELECTION] && g_reset[id] >= g_hclass_reset[HCLASSES_SELECTION])
{
// Store selection for the next infection
g_humanclassnext[id] = HCLASSES_SELECTION;
// Show selected zombie class info and stats
zp_colored_print(id, "^x04[ZP]^x01 %L: %s", id, "HUMAN_SELECT", g_hclass_name[g_humanclassnext[id]])
zp_colored_print(id, "^x04[ZP]^x01 %L: %d %L: %d %L: %d %L: %d", id, "ZOMBIE_ATTRIB1", g_hclass_hp[g_humanclass[id]], id, "HUMAN_ATTRIB", g_hclass_armor[g_humanclassnext[id]], id, "ZOMBIE_ATTRIB2", g_hclass_spd[g_humanclassnext[id]],
id, "ZOMBIE_ATTRIB3", floatround(g_hclass_grav[g_humanclassnext[id]]*800))
}
else
{
zp_colored_print(id, "^x04[ZP]^x01 No tenes Nivel o reset suficiente para elegir esta Clase de Humano. [Nivel Requerido: %d] [Reset Requerido: %d]", g_hclass_lvl[HCLASSES_SELECTION], g_hclass_reset[HCLASSES_SELECTION])
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
desde ya muchas gracias
Last edited by Roccoxx; 06-25-2012 at 14:51.
|
|