Raised This Month: $12 Target: $400
 3% 

Health Bonus!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dj_freeze
Veteran Member
Join Date: Dec 2009
Location: Looking for you!
Old 03-12-2010 , 13:59   Health Bonus!
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <fun>
 
#define HEALTH_BONUS 15
#define HEALTH_MAX 100
 
public plugin_init()
        
register_event("DeathMsg""DeathMsg""a""1>0");
 
public 
DeathMsg()
{
        new 
Killer read_data);
        
        if( 
Killer == read_data) )
                return;
        
        new 
Health get_user_health(Killer);
 
        if (
Health 100)
                
set_user_healthKillerminHealth HEALTH_BONUSHEALTH_MAX ) );

I use this plugin for health bonuses.. When player kills someone he gets health.. But there is one thing.. When you suicide, players stucks and don't spawn any more until they reconnect.. Can you fix this?
__________________
dj_freeze is offline
Send a message via Skype™ to dj_freeze
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 03-12-2010 , 14:21   Re: Health Bonus!
Reply With Quote #2

I guess you should use:
Code:
#include <amxmodx> 
#include <fun> 
  
#define HEALTH_BONUS 15 
#define HEALTH_MAX 100 
  
public plugin_init() 
        register_event("DeathMsg", "DeathMsg", "a", "1>0"); 
  
public DeathMsg() 
{ 
        new Killer = read_data( 1 ); 
         
        if( Killer == read_data( 2 ) ) 
                return; 
         
        new Health = get_user_health(Killer); 
  
        if (Health < 100 && Health > 1) 
                set_user_health( Killer, min( Health + HEALTH_BONUS, HEALTH_MAX ) ); 
}
because when he is dead, it has health 0, and automaticaly he gets 100, so the server thinks he is alive
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
dj_freeze
Veteran Member
Join Date: Dec 2009
Location: Looking for you!
Old 03-12-2010 , 15:02   Re: Health Bonus!
Reply With Quote #3

Quote:
Originally Posted by Brreaker View Post
I guess you should use:
Code:
#include <amxmodx> 
#include <fun> 
  
#define HEALTH_BONUS 15 
#define HEALTH_MAX 100 
  
public plugin_init() 
        register_event("DeathMsg", "DeathMsg", "a", "1>0"); 
  
public DeathMsg() 
{ 
        new Killer = read_data( 1 ); 
         
        if( Killer == read_data( 2 ) ) 
                return; 
         
        new Health = get_user_health(Killer); 
  
        if (Health < 100 && Health > 1) 
                set_user_health( Killer, min( Health + HEALTH_BONUS, HEALTH_MAX ) ); 
}
because when he is dead, it has health 0, and automaticaly he gets 100, so the server thinks he is alive
Thanks... I'll try and write back
__________________
dj_freeze is offline
Send a message via Skype™ to dj_freeze
lazarev
Veteran Member
Join Date: Sep 2008
Old 03-12-2010 , 15:12   Re: Health Bonus!
Reply With Quote #4

PHP Code:
#include < amxmodx >
#include < fun >
 
#define HEALTH_BONUS 15
#define HEALTH_MAX 100
 
public plugin_init()
    
register_event("DeathMsg""DeathMsg""a""1>0");
 
public 
DeathMsg()
{
    new 
Killer read_data);
    new 
Victim read_data);
        
    if( 
Killer != Victim)
    {
        new 
Health get_user_health(Killer);
 
        if (
<= Health HEALTH_MAX)
        {
            
set_user_healthKillerminHealth HEALTH_BONUSHEALTH_MAX ) );
        }
    }

lazarev is offline
dj_freeze
Veteran Member
Join Date: Dec 2009
Location: Looking for you!
Old 03-12-2010 , 15:14   Re: Health Bonus!
Reply With Quote #5

It's working perfectly!!
__________________
dj_freeze is offline
Send a message via Skype™ to dj_freeze
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 07:09.


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