09/03/2014, 12:50 AM
(Última modificación: 02/07/2014, 04:47 PM por Evil Spiret.)
Hola chicos estaba al pedo , y mi zp no tenia un menu de bombas ; me base en otro sistema , pero arme este ;
Cambie unas pequeñas cosillas que estaban al pedo y mal ; Actualizacion 04/05/2014
Dejo otro sistema aun mejor ; Actualizacion 02/07/2014
1er sistema
2do sistema
3er sistema
Cambie unas pequeñas cosillas que estaban al pedo y mal ; Actualizacion 04/05/2014
Dejo otro sistema aun mejor ; Actualizacion 02/07/2014
1er sistema
Vamos a
Debajo de
ponemos...
En donde quieran colocan esto...
Haaa, Olvide algo ; Para sacar las granadas que te da cuando elejis las pistolitas
Borramos
Y borramos
Código PHP:
// Give the new weapon with full ammo
Debajo de
Código PHP:
fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid])
ponemos...
Código PHP:
show_menu_granades(id)
En donde quieran colocan esto...
Código PHP:
public show_menu_granades(id)
{
new menu = menu_create("\rMenu de Bombas", "menu_handler")
if(g_level[id] <= 0) // Lvl necesario
{
menu_additem(menu, "\r ^n\d\y|1\w Bomba Flare \d\y|1\w Bomba Hielo\y||\w \d \r[Min Lvl 1]", "1", 0)
}
else if (g_level[id] >= 0)
{
menu_additem(menu, "\r \w\y|1\w Bomba Flare \w\y|1\w Bomba Hielo\y||\w \w", "1", 0)
}
if(g_level[id] <= 25)
{
menu_additem(menu, "\r \d\y|1\w Bomba Molotov \d\y|2\w Bomba Hielo\y||\w \d \r[Min Lvl 25]", "2", 0)
}
else if (g_level[id] >= 25)
{
menu_additem(menu, "\r \w\y|1\w Bomba Molotov \w\y|2\w Bomba Hielo\y||\w \w", "2", 0)
}
if(g_level[id] <= 40)
{
menu_additem(menu, "\r \d\y|2\w Bomba Molotov \d\y|1\w Bomba Droga \d\y|1\w\y||\w \r[Min Lvl 50]", "3", 0)
}
if(g_level[id] >= 40)
{
menu_additem(menu, "\r \w\y|2\w Bomba Molotov \w\y|\w1 Bomba Droga \w\y|1\w\y||\w", "3", 0)
}
if(g_level[id] <= 100)
{
menu_additem(menu, "\r \d\y|2\w Bomba Molotov \d\y|\w2 Bomba Droga \d\y|\w1 Campo de Fuerza\y||\w \r[Min Lvl 500]", "4", 0)
}
else if (g_level[id] >= 100)
{
menu_additem(menu, "\r \w\y|2\w Bomba Molotov \w\y|2\w Bomba Droga \w\y|1\w Campo de Fuerza\y||\w", "4", 0)
}
menu_display(id, menu, 0)
}
public menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
if(g_zombie[id])
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
if (g_level[id] >= 0) // Level Necesario para elegir este pack
{
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_flashbang")
}
}
case 2:
{
if (g_level[id] >= 25)
{
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_flashbang")
} else
zp_colored_print(id, "No tienes nivel suficiente para este pack de bombas")
}
case 3:
{
if (g_level[id] >= 40)
{
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_flashbang")
}else
zp_colored_print(id, "No tienes nivel suficiente para este pack de bombas")
}
case 4:
{
if (g_level[id] >= 100)
{
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_smokegrenade")
} else
zp_colored_print(id, "No tienes nivel suficiente para este pack de bombas")
}
}
}
return PLUGIN_HANDLED
}
Haaa, Olvide algo ; Para sacar las granadas que te da cuando elejis las pistolitas
Borramos
Código PHP:
// Give additional items
static i
for (i = 0; i < sizeof g_additional_items; i++)
fm_give_item(id, g_additional_items[i])
}
Y borramos
Código PHP:
// Additional Items to give after buying all weapons (e.g. grenades)
new const g_additional_items[][] = { "weapon_hegrenade", "weapon_flashbang", "weapon_smokegrenade" }
2do sistema
Aca dejo una mejor forma
El plugin es de 3mcy daimon't
El plugin es de 3mcy daimon't
Código PHP:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fun>
#include <cstrike>
#define PLUGIN "Menu de bombas"
#define VERSION "1.0"
#define AUTHOR "---"
enum _:menu_nades {
nombre[33],
cantidad1,
cantidad2,
cantidad3,
nivel
}
new const nades[][menu_nades] = {
{"+ 1 HE | + 1 Flash | + 1 Smoke", 1, 1, 1, 0 },
{"+ 2 HE | + 2 Flash | + 2 Smoke", 2, 2, 2, 5 },
{"+ 3 HE | + 3 Flash | + 3 Smoke", 3, 3, 3, 10},
{"+ 4 HE | + 4 Flash | + 4 Smoke", 4, 4, 4, 15},
{"+ 5 HE | + 5 Flash | + 5 Smoke", 5, 5, 5, 20}
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /bombas", "show_menu_granadas")
}
public show_menu_granadas(id) {
new menu = menu_create("\wMenu de bombas", "menu_bombas_handler")
new num[3], len[1024]
for (new i = 0; i < sizeof nades; i++) {
num_to_str(i, num, 2)
if(variable_nivel[id] >= nades[i][nivel])
formatex(len, sizeof len - 1, "\y [\w%s\y]" , nades[i][nombre])
else formatex(len, sizeof len - 1, "\d [%s] \r[Nivel: %d]" , nades[i][nombre] , nades[i][nivel])
menu_additem(menu, len, num)
}
menu_setprop(menu, MPROP_BACKNAME, "\yAtras")
menu_setprop(menu, MPROP_NEXTNAME, "\ySiguiente")
menu_setprop(menu, MPROP_EXITNAME, "\ySalir")
menu_display(id, menu, 0)
}
public menu_bombas_handler(id, menu, item) {
if(item == MENU_EXIT || !is_user_connected(id)) {
menu_destroy(menu)
return PLUGIN_HANDLED
}
if(variable_nivel[id] < nades[item][nivel]) {
print_color(id, "Para este pack tu nivel debe ser:^x04 %d.", nades[item][nivel])
show_menu_granadas(id)
return PLUGIN_HANDLED;
}
give_item(id, "weapon_hegrenade")
cs_set_user_bpammo(id, CSW_HEGRENADE, nades[item][cantidad1])
give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, nades[item][cantidad2])
give_item(id, "weapon_smokegrenade")
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, nades[item][cantidad3])
menu_destroy(menu)
return PLUGIN_CONTINUE;
}
stock print_color(id, const mensaje[], any:...) {//Stock para mensajes de color
static buffer[128]
vformat(buffer, charsmax(buffer), mensaje, 3)
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, id)
write_byte(id)
write_string(buffer)
message_end()
}
3er sistema
Arriba del plugin esto
Abajo de todo el public show_menu_buy2(id)
Arriba de public menu_extras(id, key)
Ahora registramos el menu en public plugin_init()
Código PHP:
new const GRANADAS[][] =
{
"1 FUEGO - 1 HIELO - 1 LUZ",
"2 FUEGO - 1 HIELO - 1 LUZ",
"1 FUEGO - 2 HIELO - 1 LUZ",
"2 FUEGO - 1 HIELO - 3 LUZ",
"1 FUEGO - 1 LUZ - 1 BUBBLE",
"2 FUEGO - 2 LUZ - 2 BUBBLE"
}
new const GRANADAS_NIVEL[] =
{
1,
25,
40,
60,
90,
150
}
new const GRANADAS_1[] =
{
1,
2,
1,
2,
1,
2
}
new const GRANADAS_2[] =
{
1,
1,
2,
1,
1,
2
}
new const GRANADAS_3[] =
{
1,
1,
1,
3,
1,
2
}
Abajo de todo el public show_menu_buy2(id)
Código PHP:
show_menu_buy3(id)
{
static menu[400], len
len = 0
// Title
len += formatex(menu[len], sizeof menu - 1 - len, "\wMENU DE \rGRANADAS^n^n")
for (new i = 0; i < 6; i++)
{
if(g_nivel[id] >= GRANADAS_NIVEL[i])
len += formatex(menu[len], charsmax(menu) - len, "\r%d.\w %s \y[Nivel: %d]^n", i+1, GRANADAS[i], GRANADAS_NIVEL[i])
else
len += formatex(menu[len], charsmax(menu) - len, "\r%d.\d %s [Nivel: %d]^n", i+1, GRANADAS[i], GRANADAS_NIVEL[i])
}
// 8. Auto Select
len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L \y[%L]", id, "MENU_AUTOSELECT", id, (WPN_AUTO_ON) ? "MOTD_ENABLED" : "MOTD_DISABLED")
// 0. Exit
len += formatex(menu[len], sizeof menu - 1 - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Buy Menu 3")
return PLUGIN_HANDLED
}
Arriba de public menu_extras(id, key)
Código PHP:
public menu_buy3(id, key)
{
// Zombies or survivors get no guns
if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
return PLUGIN_HANDLED;
// Special keys / weapon list exceeded
if (key >= 7)
{
// Toggle autoselect
if (key == MENU_KEY_AUTOSELECT)
WPN_AUTO_ON = 1 - WPN_AUTO_ON
// Reshow menu unless user exited
if (key != MENU_KEY_EXIT)
show_menu_buy3(id)
return PLUGIN_HANDLED;
}
if(g_nivel[id] >= GRANADAS_NIVEL[key])
{
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_smokegrenade")
fm_set_user_bpammo(id, CSW_HEGRENADE, GRANADAS_1[key])
fm_set_user_bpammo(id, CSW_FLASHBANG, GRANADAS_2[key])
fm_set_user_bpammo(id, CSW_SMOKEGRENADE, GRANADAS_3[key])
// Para Agregar Alguna Bomba En Especial Agrégale La Variable Ay
/*
if(key == 4 || key == 5) // Setear variable campo de fuerza
g_granada_smoke[id] = 1 */
}
else
{
zp_colored_print(id, "^x04[ZP PSA] ^x01No tenes nivel suficiente para ese ^x03Pack de Granadas.")
show_menu_buy3(id)
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
Ahora registramos el menu en public plugin_init()
Código PHP:
register_menu("Buy Menu 3", KEYSMENU, "menu_buy3")