Raised This Month: $ Target: $400
 0% 

HP regenerator


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 11-03-2014 , 11:25   Re: HP regenerator
Reply With Quote #2

try:
PHP Code:
#include <amxmodx>
#include <fun>

#define TASK_REGEN    328479239

new max_hphp_timehp_giveregen_hp[33]

public 
plugin_init()  
{
    
register_plugin("VIP REGENERATOR""1.0""AMXMODX")
    
    
max_hp register_cvar("HR_maxhp""140")
    
hp_time register_cvar("HR_hptime""2.0")
    
hp_give register_cvar("HR_hpgive""2")
    
register_clcmd("say /reg""generate_hp")
}

public 
generate_hp(id)
{
    if(!
task_exists(id TASK_REGEN))
    {
        
set_task(get_pcvar_float(hp_time), "regen"id TASK_REGEN__"b")
        
regen_hp[id] = 0
    
}
}

public 
regen(taskid)
{
    new 
id taskid TASK_REGEN
    
    
if(!is_user_alive(id) || regen_hp[id] == 40)
    {
        
remove_task(taskid)
        return
    }
    
    new 
health get_user_health(id)
    new 
maxhp get_pcvar_num(max_hp)
    new 
hpgive get_pcvar_num(hp_give)
    
    if((
health hpgive) >= maxhp)
    {
        
set_user_health(idmaxhp)
        
remove_task(taskid)
    }
    else 
    {
        
set_user_health(idhealth hpgive)
        
regen_hp[id] += hpgive
    
}

RateX 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 17:31.


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