I solved it already.
Here's how I did it..
PHP Code:
new g_itemindex1
new g_itemindex2
new g_has_fast_energy[MAXPLAYERS + 1] = {false, ...}
adding the items in plugin_init()
PHP Code:
g_itemindex1 = zp_register_extra_item("Energy Boost \y[\r+10\y]", 30, ZP_TEAM_HUMAN) //30
g_itemindex2 = zp_register_extra_item("Faster Energy \d(\rx3\d)", 60, ZP_TEAM_HUMAN) //60
Making the g_itemindex1 & g_itemindex2
PHP Code:
public zp_extra_item_selected(id, itemid)
{
if(itemid == g_itemindex1) {
g_nn_energy[id] += 10
client_cmd(id,"spk %s",regain_sound)
set_dhudmessage(255, 0, 0, 0.55, 0.56, 0, 6.0, 6.0);
show_dhudmessage(id, "+10% Energy");
ChatColor(id, "!g[Fatall-Error] !yYou successfully upgraded your suit!");
}
if(itemid == g_itemindex2)
{
if(g_has_fast_energy[id])
{
client_print(id, print_center, "You already have Fast Energy!")
return ZP_PLUGIN_HANDLED
}
g_has_fast_energy[id] = true
client_cmd(id,"spk %s",regain_sound)
set_dhudmessage(55, 55, 155, 0.55, 0.56, 0, 6.0, 6.0);
show_dhudmessage(id, "+Faster Energy");
ChatColor(id, "!g[Fatall-Error] !yYou successfully upgraded your suit!");
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, id)
write_short(1<<12)
write_short(1<<12)
write_short(0x0000)
write_byte(25)
write_byte(25)
write_byte(255)
write_byte(100)
message_end()
}
return PLUGIN_CONTINUE
}
And finally the energy manipulation
PHP Code:
if (energy < g_nn_energy[id] && cl_nn_mode[id] != NANO_CLOAK && cl_nn_block_recharge[id] == 0)
{
static Float:energy2
if(g_has_fast_energy[id] && itemid == g_itemindex1)
energy2 = 3.0 //regen
else if (g_has_fast_energy[id])
energy2 = 3.0 //regen
else
energy2 = get_pcvar_float(pcv_nn_regenerate)
if (pev(id,pev_button) & IN_DUCK && cl_nn_speed[id] == SPD_STILL)
energy2 *= ENERGY_CROUCH
energy2 += energy
// Useful to block the moment when a player energy is bigger than the maximum energy
energy = floatmin(g_nn_energy[id], energy2)
if (energy > get_pcvar_float(pcv_nn_critical) + CRITICAL_EXTRA_ADD)
cl_nn_critical[id] = false
}