AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Max Health HELP (https://forums.alliedmods.net/showthread.php?t=206334)

Podarok 01-21-2013 05:13

Max Health HELP
 
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 


zEEDu 01-21-2013 05:26

Re: Max Health HELP
 
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


Podarok 01-21-2013 05:30

Re: Max Health HELP
 
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




All times are GMT -4. The time now is 13:47.

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