Raised This Month: $ Target: $400
 0% 

[HELP] Last Problem! =]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 06-11-2009 , 19:37   [HELP] Last Problem! =]
Reply With Quote #1

Code:
        if (sum < 100)
        {
            set_user_health(id, sum);
        }
            else
        {
             set_user_health(id, 100);
         }
             gfNextHealTime[id] = halflife_time() + 0.5;

How can you make it so when you touch the heal block n u got over 100 hp it doesnt just set it to 100 again.


And I have a 2nd block called SuperHeal making it go from 0-220 HP

but when i go in it, it just sets it down to 100 please help!
malec321 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-11-2009 , 19:39   Re: [HELP] Last Problem! =]
Reply With Quote #2

Quote:
Originally Posted by malec321 View Post
Code:
        if (sum < 100)
        {
            set_user_health(id, sum);
        }
            else
        {
             set_user_health(id, 100);
         }
             gfNextHealTime[id] = halflife_time() + 0.5;

How can you make it so when you touch the heal block n u got over 100 hp it doesnt just set it to 100 again.


And I have a 2nd block called SuperHeal making it go from 0-220 HP

but when i go in it, it just sets it down to 100 please help!
Where do you want it capped off at?

set_user_health(id, get_user_health(id) + 100 ); ??
__________________
Bugsy is offline
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 06-11-2009 , 19:44   Re: [HELP] Last Problem! =]
Reply With Quote #3

I want it capped at 255



Here

Super Heal Code (Up to 220 HP) dont set it back to 220 or 100 if u have 255 HP:
Code:
actionSHEAL(id)
{
    if (halflife_time() >= gfNextSHEALTime[id])
    {
        new hp = get_user_health(id);
        new amount = floatround(get_cvar_float("bm_shealamount"), floatround_floor);
        new sum = (hp + amount);

        if (sum < 100)
        {
            set_user_health(id, sum);
        }
            else
        {
             set_user_health(id, 100);
         }
             gfNextHealTime[id] = halflife_time() + 0.5;
    }
}
Normal Heal (Go up to 100 HP) but dont let it go down back to 100 if u got 255 HP:

Code:
actionHeal(id)
{
    if (halflife_time() >= gfNextHealTime[id])
    {
        new hp = get_user_health(id);
        new amount = floatround(get_cvar_float("bm_healamount"), floatround_floor);
        new sum = (hp + amount);
        
        if (sum < 100)
        {
            set_user_health(id, sum);
        }
            else
        {
             set_user_health(id, 100);
         }
             gfNextHealTime[id] = halflife_time() + 0.5;
    }
}

Last edited by malec321; 06-11-2009 at 19:48.
malec321 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-11-2009 , 19:50   Re: [HELP] Last Problem! =]
Reply With Quote #4

PHP Code:
if (halflife_time() >= gfNextHealTime[id])
{
    new 
amount floatround(get_cvar_float("bm_healamount"), floatround_floor);
   
    
set_user_healthid clampget_user_healthid ) + clampamount 100 ) , 255 ) );
    
gfNextHealTime[id] = halflife_time() + 0.5;

__________________

Last edited by Bugsy; 06-11-2009 at 19:53.
Bugsy is offline
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 06-11-2009 , 19:55   Re: [HELP] Last Problem! =]
Reply With Quote #5

if (halflife_time() >= gfNextHealTime[id])
{
new
amount = floatround(get_cvar_float("bm_healamount"), floatround_floor);

set_user_health( id , clamp( get_user_health( id ) + clamp( amount , 100 ) , 0 , 255 ) );
gfNextHealTime[id] = halflife_time() + 0.5;
}

And if its SHEAL it would be:

if (halflife_time() >= gfNextHealTime[id])
{
new
amount = floatround(get_cvar_float("bm_shealamount"), floatround_floor);

set_user_health( id , clamp( get_user_health( id ) + clamp( amount , 200 ) , 0 , 255 ) );
gfNextHealTime[id] = halflife_time() + 0.5;
}


rite?
malec321 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-11-2009 , 19:58   Re: [HELP] Last Problem! =]
Reply With Quote #6

shouldnt sheal be 220 and not 200 or is the above a typo
__________________
Bugsy is offline
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 06-11-2009 , 19:59   Re: [HELP] Last Problem! =]
Reply With Quote #7

yea sry its correct rite?
malec321 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-11-2009 , 20:11   Re: [HELP] Last Problem! =]
Reply With Quote #8

It should, try it out and let me know. Quick question, why are you rounding a cvar?
__________________
Bugsy is offline
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 06-11-2009 , 20:23   Re: [HELP] Last Problem! =]
Reply With Quote #9

rounding? lmao sry not so good with the scripting terms
malec321 is offline
malec321
Senior Member
Join Date: May 2009
Location: Los Angeles
Old 06-11-2009 , 20:24   Re: [HELP] Last Problem! =]
Reply With Quote #10

i tryed it and i posted the new script and wat errors i got.
malec321 is offline
Reply


Thread Tools
Display Modes

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 13:49.


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