Raised This Month: $ Target: $400
 0% 

Adding HP (don't know how to call this properly)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-27-2013 , 13:52   Adding HP (don't know how to call this properly)
Reply With Quote #1

I have this code:
PHP Code:
public hook_death()
{
    
// Killer id
    
nKiller read_data(1)
    if(
is_user_alive(nKiller)) 
    {
        if ( (
read_data(3) == 1) && (read_data(5) == 0) )
        {
            
nHp_add get_pcvar_num (health_hs_add)
        }
        else
        
nHp_add get_pcvar_num (health_add)
        
nHp_max get_pcvar_num (health_max)
        
// Updating Killer HP
        
if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
        return;
    
        
nKiller_hp get_user_health(nKiller)
        
nKiller_hp += nHp_add
        
// Maximum HP check
        
if (nKiller_hp nHp_maxnKiller_hp nHp_max
        set_user_health
(nKillernKiller_hp)
        
// Hud message "Healed +15/+30 hp"
        
if(nKiller_hp nHp_max)
        {
            
set_hudmessage(02550, -1.00.1501.01.00.10.1, -1)
            
show_hudmessage(nKiller"Healed +%d hp"nHp_add)
        }
        
// Screen fading
        
if(!is_user_flashed(nKiller)) //Checks if user is not flashed
        
{
            
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, nKiller)
            
write_short(1<<10)
            
write_short(1<<10)
            
write_short(0x0000)
            
write_byte(0)
            
write_byte(0)
            
write_byte(200)
            
write_byte(75)
            
message_end()
        }
    }

And when hud message is sent, f.e. if you have 90 hp (maximum is 100) and you kill someone it still shows that you got 15 HP, but you got only 10... (30hp if kill with head shot). So... I can't figure out how should I do that.

I am thinking of getting user health, then adding nHp_add and - 100? But I believe that I might get lots of errors... If someone can do it, please do it

Last edited by Unkolix; 02-27-2013 at 14:06.
Unkolix is offline
 



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 21:46.


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