Raised This Month: $ Target: $400
 0% 

Max Health HELP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 01-21-2013 , 05:13   Max Health HELP
Reply With Quote #1

Hey. I need help with max health stock. People have their health above 100, so this stock is kinda useless. How do i get their actual max health (not 100). Im running ZM server, so HP changes dynamically (change Zp class)
PHP Code:
stock get_user_maxhealthidUser )
{
    new 
maxHealth 100

    
static iSkillLevel;
    
iSkillLevel SM_GetSkillLevelidUserSKILL_DEVOTION );

    
// Human Devotion Skill
    
if ( iSkillLevel )
    {
        
maxHealth += iSkillLevel p_devotion;
    }

    
// For talisman +
    // Player has a health bonus from the Periapt of Health
    
if ( ITEM_HasidUserITEM_HEALTH ) > ITEM_NONE || fWorkTalismanPassive(idUserarrTalismanActive[idUser]) == TALISMAN_ITEM_HEALTH )
        
maxHealth += get_pcvar_numCVAR_wc3_health );
        
    if(
maxHealth 255)
        
maxHealth 255;
        
    return 
maxHealth

Can i simply use
PHP Code:
pev(idUserpev_max_healthmaxHealth
Instead of
PHP Code:
new maxHealth 100 
Podarok is offline
zEEDu
Junior Member
Join Date: Jan 2013
Location: Vaasa, Finland
Old 01-21-2013 , 05:26   Re: Max Health HELP
Reply With Quote #2

Use the native?

PHP Code:
/**
 * Returns the default maximum health for a specific zombie class.
 *
 * Note: does not take into account any kind of HP multipliers.
 *
 * @param id        Player index.
 * @param classid    A valid zombie class ID.
 * @return            Maximum amount of health points, -1 on error.
 */
native zp_class_zombie_get_max_health(idclassid
__________________
PM for Private Work!

Scandinavian Gaming Association
zEEDu is offline
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 01-21-2013 , 05:30   Re: Max Health HELP
Reply With Quote #3

Only for zombies and does not count HP multipliar. Thats why i dont even consider using this.
If i use pev_max_health , the code will look like this right? Correct it please , if smth is wrong :
PHP Code:
stock get_user_maxhealthidUser )
{
    new 
FloatmaxHealth

     pev
(idUserpev_max_healthmaxHealth)

    static 
iSkillLevel;
    
iSkillLevel SM_GetSkillLevelidUserSKILL_DEVOTION );

    
// Human Devotion Skill
    
if ( iSkillLevel )
    {
        
maxHealth += iSkillLevel p_devotion;
    }

    
// For talisman +
    // Player has a health bonus from the Periapt of Health
    
if ( ITEM_HasidUserITEM_HEALTH ) > ITEM_NONE || fWorkTalismanPassive(idUserarrTalismanActive[idUser]) == TALISMAN_ITEM_HEALTH )
        
maxHealth += get_pcvar_numCVAR_wc3_health )

    new 
newHealth floatround(maxHealth)
    
    return 
newHealth


Last edited by Podarok; 01-21-2013 at 06:01.
Podarok is offline
Old 01-22-2013, 06:33
Podarok
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
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 13:47.


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