This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

#[Request] - HP Regenerator (max. 100)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 10-05-2014 , 04:38   #[Request] - HP Regenerator (max. 100)
Reply With Quote #1

Hallo all. I am new member here and It's my first requset. I hope you will help me.

I need HP Regenerator plugin go regenerate max 100 HP. Ex: When is player's health 90 then HP Regenerator give +10 HP to player and HP Regenerator's hp is 90. HP Regenerator player can buy when say: /shop. HP Regenerator costs 5000$. Sorry for my bad english.
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
sasske
Senior Member
Join Date: Nov 2012
Old 10-05-2014 , 12:13   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #2

Try with this code:

Sell you +1 point of health for $50

For a example if you have $5000 and 30 points of life you use /health

->

$1500 and 100 life points

And if you not have necesary money, for example:

$2000 and 50 life points

->

$0 and 90 life points (40 life points * 50 = $2000)

Code:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "HealthSell"
#define VERSION "1.0"
#define AUTHOR "Autor"


public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /health""HealthCMD")
}

public 
HealthCMD(id)
{
    new 
userH get_user_health(id)
    new 
userM cs_get_user_money(id)
    
    if(
userH>= 100)
        
client_print(idprint_chat"You have all life points")
    else if(
userM>=100*50-userH*50)
    {
        
userM-=100*50-userH*50
        client_print
(idprint_chat"You paid %d for %d life points"100*50-userH*50100-userH)
        
set_user_health(id100)
    }
    else if(
userM>= 50)
    {
        new 
i2=1
        
for(new i=1i<100i++)
        {
            if(
userM-50*i>=0)
            {
                
i2++
                continue
            }
            else
                break
        }
        
set_user_health(idget_user_health(id) + i2)
        
cs_set_user_money(iduserM-i2*50)
        
client_print(idprint_chat"You paid %d for %d life points (no more money)"i2*50i2)
    }

sasske is offline
Send a message via MSN to sasske
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 10-05-2014 , 14:28   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #3

Bro, look. Player can buy HP Regenerator if player have 100 HP too. When player say /health, player get HP Regenerator for 5000$ and player can see message: "You have successfully bought HP Regenerator (max 100)". If player already have HP Regenerator then player can see message: "You already have HP Regenerator (max 100)". If player don't have money to buy HP Regenerator, player can see message: "You don't have enough money to buy HP Regenerator (max 100)". If player have 90 HP then HP Regenerator automaticly give to player 10 HP. If player have HP Regenerator (max 100), player can see hud message: "HP Regenerator (max 100): "show allow hp of hp regenerator"". I hope you understend me... THX!
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 10-05-2014 , 16:21   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #4

I found this plugin too:

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

#define Plugin "Health Regenerator"
#define Version "1.1"
#define Author "Doombringer"

new max_hphp_timehp_give
public plugin_init()
{
    
register_plugin(PluginVersionAuthor)
    
    
register_event("DeathMsg""hook_death""a")
    
register_event("Damage""hook_damage""b")
    
    
max_hp register_cvar("HR_maxhp""100")
    
hp_time register_cvar("HR_hptime""5")
    
hp_give register_cvar("HR_hpgive""1")
}

public 
client_disconnect(id)
{
    if(
task_exists(id))
        
remove_task(id)
}

public 
hook_death()
{
    new 
victim read_data(2)
    
    if(
task_exists(victim))
        
remove_task(victim)
}

public 
hook_damage(id)
{
    if(!
task_exists(id))
        
set_task(get_pcvar_float(hp_time), "generate_hp"id,_,_"b")
}

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), 0get_pcvar_num(max_hp))    
    
set_user_health(idhptogive)
    
    return 
PLUGIN_CONTINUE

But I want this:
Every spawn player have 100 HP. If player bought HP Regenerator (max. 100), Player can see message:HP Regenerator (max. 100): "Allow HP".

ex: Player bought HP Regenerator (max 100) and player lose 16 HP, HP Regenerator give 16 HP to player but HP Regenerator (max. 100) lose 16 HP then player can see hud message: "HP Regenerator (max. 100): 74 HP". Thets all
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
mFsethh
Senior Member
Join Date: Jun 2014
Old 10-06-2014 , 04:43   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #5

But I think is beather to use this HP Regenerator. No (max. 100). I think beather is HP Renegerator for one round... hh I don't know how to make it
mFsethh is offline
Send a message via Yahoo to mFsethh Send a message via Skype™ to mFsethh
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 10-06-2014 , 10:10   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #6

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

const TASK_ID 100;

enum Cvars {
    
TIME_ADD,
    
HEALTH_ADD,
    
HEALTH_MAX
}

new 
cvars[Cvars];

public 
plugin_init() {
    
register_plugin("Health Regeneration""1.0""OnePL");

    
cvars[TIME_ADD] = register_cvar("amx_reg_time""1");
    
cvars[HEALTH_ADD] = register_cvar("amx_reg_hp""10");
    
cvars[HEALTH_MAX] = register_cvar("amx_reg_max""100");

    
register_event("Health""CheckHealth""be""1>0""1<100");
}

public 
CheckHealth(idset_task(get_cvar_float(cvars[TIME_ADD]), "AddHealth"id TASK_ID, .flags="b");

public 
AddHealth(id) {
    
id -= TASK_ID;

    if(!
is_user_alive(id)) {
        
remove_task(id TASK_ID);
        return 
0;
    }
    
set_user_health(idmin(get_user_health(id) + get_cvar_num(cvars[HEALTH_ADD]), get_cvar_num(cvars[HEALTH_MAX])));
    return 
0;

OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 10-06-2014 , 15:27   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #7

But where is /health ? Bro... I want to player buy HP Regenerator for ONE ROUND by teaping /health...

Last edited by BaD CopY; 10-06-2014 at 15:30.
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 10-06-2014 , 15:57   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #8

Sorry

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

const TASK_ID 100;

enum Cvars {
    
TIME_ADD,
    
HEALTH_ADD,
    
HEALTH_MAX,
    
HEALTH_COST
}

new 
pCvar[Cvars];
new 
regeneration[33];

public 
plugin_init() {
    
register_plugin("Health Regeneration""1.0""OnePL");

    
register_clcmd("say /health""CheckCommand");

    
pCvar[TIME_ADD] = register_cvar("amx_reg_time""1");
    
pCvar[HEALTH_ADD] = register_cvar("amx_reg_hp""10");
    
pCvar[HEALTH_MAX] = register_cvar("amx_reg_max""100");
    
pCvar[HEALTH_COST] = register_cvar("amx_reg_cost""5000");

    
register_event("HLTV""NewRound""a""1=0""2=0");
    
register_event("Health""CheckHealth""be""1>0""1<100");
}

public 
NewRound() {
    new 
players[32], numid;
    
get_players(playersnum"chi");

    for(new 
inumi++) {
        
id players[i];

        if(!
regeneration[id]) continue;

        
regeneration[id] = false;
        
remove_task(id TASK_ID);
    }
}

public 
CheckCommand(id) {
    if(!
is_user_alive(id)) {
        
client_print(id3"Only alive players can use this command!");
        return;
    }
    if(
regeneration[id]) {
        
client_print(id3"You already used this command in this round.");
        return;
    }
    if(
get_user_health(id) >= pCvar[HEALTH_MAX]) {
        
client_print(id3"You have MAX HP.");
        return;
    }
    if(
cs_get_user_money(id) < pCvar[HEALTH_COST]) {
        
client_print(id3"You do not have enough money.");
        return;
    }
    
regeneration[id] = true;
    
cs_set_user_money(idcs_get_user_money(id) - pCvar[HEALTH_COST]);
}

public 
CheckHealth(id) {
    if(!
regeneration[id]) return;

    
set_task(get_cvar_float(pCvar[TIME_ADD]), "AddHealth"id TASK_ID, .flags="b");
}

public 
AddHealth(id) {
    
id -= TASK_ID;

    if(!
is_user_alive(id)) {
        
regeneration[id] = false;
        
remove_task(id TASK_ID);
        return 
0;
    }
    
set_user_health(idmin(get_user_health(id) + get_cvar_num(pCvar[HEALTH_ADD]), get_cvar_num(pCvar[HEALTH_MAX])));
    return 
0;

OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 10-07-2014 , 04:40   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #9

I can compile it but it doese't work...
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 10-07-2014 , 12:21   Re: #[Request] - HP Regenerator (max. 100)
Reply With Quote #10

Work... I tested.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Reply



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 20:44.


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