Raised This Month: $ Target: $400
 0% 

Healing always to 100 hp no matter what I change. Need 255.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 07-30-2009 , 09:55   Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #1

Hello,

Problem is with blockmaker heal block:

If I have 255 hp and I go on heal block it goes back 100, I tried everything, I even changed it all to 255 to see if it will heal to 255, still 100.

Code:
actionHeal(id)
{
    if (halflife_time() >= gfNextHealTime[id])
    {
        new szPlayerName[32];
            get_user_name(id, szPlayerName, 32);
        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;
    }
}
I need it so if you have less then 100hp it will heal to 100. If you have like 101 it will heal to 255.
__________________
R.I.P Aziz 'Zyzz' Sergeyevich Shavershian
cikjam is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 07-30-2009 , 10:14   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #2

Just add a check:
PHP Code:
if ( get_user_healthid ) > 101 )
{
    return 
PLUGIN_HANDLED;

__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-30-2009 , 10:17   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #3

PHP Code:
actionHeal(id)
{
    if ( 
halflife_time() >= gfNextHealTime[id] )
    {
        static 
iHealthiHealth get_user_healthid );

        if ( ( 
iHealth == 100 ) || ( iHealth == 255 ) )
            return 
PLUGIN_HANDLED;

        
set_user_healthid , ( iHealth 100 ) ? 100 255 );
    
        
gfNextHealTime[id] = halflife_time() + 0.5;
    }

    return 
PLUGIN_HANDLED;

__________________

Last edited by Bugsy; 07-30-2009 at 23:11.
Bugsy is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 07-30-2009 , 10:24   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #4

Wait, now I am confused. Do you want the block to heal to 255 if the user has more then 100 hp, or just stop the users health from going down to 100 if they have more then 100?
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 07-30-2009 at 10:27.
Xellath is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-30-2009 , 10:25   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #5

Quote:
I need it so if you have less then 100hp it will heal to 100. If you have like 101 it will heal to 255.
__________________
Bugsy is offline
LaineN
Veteran Member
Join Date: Mar 2008
Location: Sweden
Old 07-30-2009 , 10:29   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #6

Code:
actionHeal(id) {     if ( !( halflife_time() >= gfNextHealTime[id] ) ) return PLUGIN_HANDLED;         new amount = floatround(get_cvar_float("bm_healamount"), floatround_floor);     new new_health = (get_user_health(id) + amount);         if ( new_health > 100 ) return PLUGIN_HANDLED;         set_user_health(id, new_health);         gfNextHealTime[id] = halflife_time() + 0.5;         return PLUGIN_HANDLED; }
__________________
Bollnas Team - HideNSeek

See all of Bollnas Team's HideNSeek
servers at
http://bollnasteam.se/!


Last edited by LaineN; 07-30-2009 at 15:53.
LaineN is offline
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 07-30-2009 , 23:59   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #7

tested them both, they both go back to 100
__________________
R.I.P Aziz 'Zyzz' Sergeyevich Shavershian
cikjam is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-31-2009 , 00:12   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #8

Quote:
Originally Posted by cikjam View Post
tested them both, they both go back to 100
I just tested it too and it works fine. Must be something else in your code or another plugin that is causing the problem.

In chat, do the following:

say "blah" - nothing should happen
now injure yourself to any degree besides killing yourself. use a grenade on yourself or something
say "blah" - your health should now be 100
say "blah" - nothing should happen, health still at 100
say "hp" - your health should now go to 110
say "blah" - your health should now go to 255
say "blah" - nothing should happen, health still at 255

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "bugsy"

new FloatgfNextHealTime[33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd"say hp" "hp" );
    
    
register_clcmd"say blah" "blah" );
}

public 
hp(id)
{
    
set_user_healthid get_user_healthid ) + 10 );
}

public 
blahid )
{
    if ( 
get_gametime() >= gfNextHealTime[id] )
    {
        static 
iHealthiHealth get_user_healthid );
    
        if ( ( 
iHealth == 100 ) || ( iHealth == 255 ) )
            return 
PLUGIN_HANDLED;
    
        
set_user_healthid , ( iHealth 100 ) ? 100 255 );
    
        
gfNextHealTime[id] = get_gametime() + 0.5;
    }
    
    return 
PLUGIN_HANDLED;

__________________
Bugsy is offline
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 07-31-2009 , 00:41   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #9

I test that blah thing, it works like you said, but when i put the actionheal in bm it doesnt work'

maybe u can try in bm, and see if works

EDIT: Btw, wheres the bm_healamount in it
__________________
R.I.P Aziz 'Zyzz' Sergeyevich Shavershian

Last edited by cikjam; 07-31-2009 at 00:50.
cikjam is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-31-2009 , 00:54   Re: Healing always to 100 hp no matter what I change. Need 255.
Reply With Quote #10

Code:
actionHeal(id) {     if ( !( halflife_time() >= gfNextHealTime[id] ) ) return PLUGIN_HANDLED;         new iHealth = get_user_health( id );     if( iHealth >= 255 || iHealth == 100 ) return PLUGIN_HANDLED;         if( iHealth < 100 )     {         iHealth = min( 100, iHealth + floatround(get_cvar_float("bm_healamount"), floatround_floor) );     }     else //if( iHealth > 100 )     {         iHealth++;         // no need to check for 255 maximum, since it is only by 1     }         set_user_health(id, iHealth);         gfNextHealTime[id] = halflife_time() + 0.5;         return PLUGIN_HANDLED; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 08-01-2009 at 15:11.
Exolent[jNr] is offline
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 18:24.


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