Raised This Month: $ Target: $400
 0% 

Solved Nanosuit 2x faster rachargable energy


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
DJBosma
Member
Join Date: Dec 2009
Old 12-26-2018 , 13:34   Re: Nanosuit 2x faster rachargable energy
Reply With Quote #4

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]"30ZP_TEAM_HUMAN//30
    
g_itemindex2 zp_register_extra_item("Faster Energy \d(\rx3\d)"60ZP_TEAM_HUMAN)  //60 
Making the g_itemindex1 & g_itemindex2

PHP Code:
public zp_extra_item_selected(iditemid)
{
if(
itemid == g_itemindex1) {
g_nn_energy[id] += 10
client_cmd
(id,"spk %s",regain_sound)
set_dhudmessage(255000.550.5606.06.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(idprint_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(55551550.550.5606.06.0);
show_dhudmessage(id"+Faster Energy");

ChatColor(id"!g[Fatall-Error] !yYou successfully upgraded your suit!");

message_begin(MSG_ONEget_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
    

DJBosma 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 07:34.


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