AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP4.3 + ZP5.0] Addon: Auto Health v1.1 (Calculated by Number of Player and Zombie) (https://forums.alliedmods.net/showthread.php?t=172732)

dias 11-25-2011 09:16

[ZP4.3 + ZP5.0] Addon: Auto Health v1.1 (Calculated by Number of Player and Zombie)
 
1 Attachment(s)
[ZP] Addon: Auto Health
Version 1.1 | Author: Dias

1. Description

- When you get infect, you will get a calculated health by number of player and number of zombie
- I hope this plugin will make your zombie server balanced about health for zombie
--- I saw much server unbalance... 32 player, 2 zombie but zombie health: 2000 -> Quick Death
- Many Zombie = Little Health | Little Zombie = Many Health

2. Calculation
- Health = (Total Player / Total Zombie) * 1000

Example 1: In your server had Total 20 player and 5 zombies
=> Health = (20 / 5) * 1000
<=> Health per zombie = 4000HP

Example 2: In your server had Total 32 player and 10 zombies
=> Health = (32 / 10) * 1000
<=> Health per zombie = 3200HP

Example 3: In your server had Total 32 player and 2 zombies
=> Health = (32 / 2) * 1000
<=> Health per zombie = 16000HP (Just lile first zombie :))

Example 4: In your server had Total 25 player and 22 zombies
=> Health = (25 / 22) * 1000
<=> Health per zombie = 1136HP

3. Cvar
- zp_auto_health 1 // Default: 1

4. Credits
- fengxy | His idea
- Dias | Make this plug

5. Fix
- v1.0 | Release
- v1.1 | Fix Nemesis Health, Add Stock Cvar (thank to yokomo)

*If you are finding for ZP5.0 version... Here (I don't sure it will good. This plug converted by JoKeR LauGh, if had error just pm him)

Please comment Before of After download http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/21.gif

styler 11-25-2011 09:26

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
Nice job :up:

NiHiLaNTh 11-25-2011 10:06

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
AFAIK in CSO health is calculated something like this right?

dias 11-25-2011 10:14

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
yes

dfwu.dark 11-25-2011 13:06

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
this is awesome ....

JoKeR LauGh 11-25-2011 18:04

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
sound nice need some code in it . Thanks ;)

datka888 11-26-2011 10:14

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
i tested it and server crashed :X

dias 11-26-2011 11:04

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
@datka888:
- Crash by yourself. I used this code since 2010 nothing wrong. but why your server crash huh ?

datka888 11-26-2011 11:08

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
Quote:

Originally Posted by dias (Post 1603010)
@datka888:
- Crash by yourself. I used this code since 2010 nothing wrong. but why your server crash huh ?

dont know , i tested it and my server crashed,but its ok,i dont need this plugin ;) i have many other ideas for this, thx.

yokomo 11-26-2011 13:47

Re: [ZP] Addon: Auto Health v1.0 (Calculated by Number of Player and Zombie)
 
Some fix, hope you like it.
PHP Code:

#include <amxmodx>
#include <fun>
#include <zombieplague>

#define PLUGIN "[ZP] Addon: Auto Health"
#define VERSION "1.0"
#define AUTHOR "Dias"

new cvar_auto_healthcvar_stock_health
new g_maxplayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_maxplayers get_maxplayers()
    
    
cvar_auto_health register_cvar("zp_auto_health""1")
    
cvar_stock_health register_cvar("zp_stock_health""1000")
}

public 
zp_user_infected_post(id)
{
    
// Nemesis? no need la
    
if(zp_get_user_nemesis(id)) return;
    
    if(
get_pcvar_num(cvar_auto_health))
    {
        new 
health
        health 
= (get_player_count() / get_zombie_count()) * get_pcvar_num(cvar_stock_health)
        
set_user_health(idhealth)
    }
}

get_zombie_count()
{
    new 
count
    
for(new 0g_maxplayersi++)
    {
        if(
is_user_connected(i) && zp_get_user_zombie(i))
            
count++
    }
    
    return 
count
}

get_player_count()
{
    new 
count
    
for(new 0g_maxplayersi++)
    {
        if(
is_user_connected(i))
            
count++
    }
    
    return 
count




All times are GMT -4. The time now is 16:21.

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