Raised This Month: $ Target: $400
 0% 

HP regenerator


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ArthHa
Member
Join Date: Apr 2014
Old 11-03-2014 , 10:49   HP regenerator
Reply With Quote #1

Hello, i need a little help with HP regenerator.

I want to:
player can have max 140 HP
regenerator max can add 40 HP

Something like this: if player health is 100, regenerator will increase it till 140
but if player health is 20, regenerator will increase it only till 60

im using this code

Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <fakemeta>

new max_hp, hp_time, hp_give

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

public generate_hp(id)
{
    new health = get_user_health(id)
    
    if(health >= get_pcvar_num(max_hp))
    {
        remove_task(id)
        return PLUGIN_CONTINUE
    }
    
    new hptogive = clamp(health + get_pcvar_num(hp_give), 0, get_pcvar_num(max_hp))    
    set_user_health(id, hptogive)
    
    return PLUGIN_CONTINUE
}
__________________


ArthHa is offline
Send a message via Skype™ to ArthHa
 



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