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

Subplugin Submission [ZP] Addon Simple Zombie HP Regen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 06-16-2011 , 23:10   [ZP] Addon Simple Zombie HP Regen
Reply With Quote #1

Plugin Description:
Just like Biohazard style it has HP regeneration for zombie.

Cvars:
zp_regen_max -- Percentage how many health you want to regenerate.
zp_regen_add -- Health amount every "regen interval".
zp_regen_interval -- Regenerate health interval.
zp_regen_dmg_delay -- Delay to start regenerate health after being hit.

Credits:
Leon M. -- add health code.
MeRcyLeZZ -- is_user_valid_* code.
Excalibur.007 -- some optimization.

Change log:
1.0.1
* some optimization, a better code i hope.
* remove fakemeta module.
* adding screen fade effect and sound.

1.0.2
* add bot support (works for all BOT).
Attached Files
File Type: zip cstrike.zip (27.5 KB, 2065 views)
File Type: sma Get Plugin or Get Source (ZP_Addon_RegenV2.sma - 3338 views - 4.9 KB)
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 06-17-2011 at 10:21. Reason: Updating a better code.
yokomo is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 06-16-2011 , 23:19   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #2

Not bad. At least is working.

It's better to cache the CVars & is_user_* as the regeneration function is repeated.

and

Bits > Bool

Overall, this plug-in is still fine.
Excalibur.007 is offline
tei1995
Senior Member
Join Date: Feb 2011
Location: VietNam
Old 06-16-2011 , 23:31   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #3

do not use native get_user_health(id) for get user health , it bug, just use pev_health is better
__________________

Hatsune Miku~
tei1995 is offline
Old 06-16-2011, 23:40
Excalibur.007
This message has been deleted by Excalibur.007. Reason: Bug found in code.
tei1995
Senior Member
Join Date: Feb 2011
Location: VietNam
Old 06-16-2011 , 23:47   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #4

sorry, i dont have some pic, when you regen, you will die with hp = -1 or your hp = 0, but, you can jump and move
__________________

Hatsune Miku~
tei1995 is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 06-16-2011 , 23:56   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #5

Oh. Then probably yokomo should switch to pev_health.

@yokomo

New code.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#define TASK_REGENERATION     134926
#define TASK_BLOCK_REGEN     151718
#define ID_REGEN         (taskid - TASK_REGENERATION)
#define ID_BLOCK_REGEN         (taskid - TASK_BLOCK_REGEN)

new g_bitConnectedPlayersg_bitAlivePlayersg_bitZombiePlayersg_bitBlockPlayers

#define MarkUserConnected(%0)   g_bitConnectedPlayers |= (1 << (%0 & 31))
#define ClearUserConnected(%0)  g_bitConnectedPlayers &= ~(1 << (%0 & 31))
#define IsUserConnected(%0)    g_bitConnectedPlayers & (1 << (%0 & 31))

#define MarkUserAlive(%0)    g_bitAlivePlayers |= (1 << (%0 & 31))
#define ClearUserAlive(%0)    g_bitAlivePlayers &= ~(1 << (%0 & 31))
#define IsUserAlive(%0)        g_bitAlivePlayers & (1 << (%0 & 31))

#define MarkUserZombie(%0)    g_bitZombiePlayers |= (1 << (%0 & 31))
#define ClearUserZombie(%0)    g_bitZombiePlayers &= ~(1 << (%0 & 31))
#define IsUserZombie(%0)    g_bitZombiePlayers & (1 << (%0 & 31))

#define MarkUserBlock(%0)    g_bitBlockPlayers |= (1 << (%0 & 31))
#define ClearUserBlock(%0)    g_bitBlockPlayers &= ~(1 << (%0 & 31))
#define IsUserBlock(%0)        g_bitBlockPlayers & (1 << (%0 & 31))

new g_maxhealth[33]
new 
g_endround
new cvar_regen_addcvar_regen_intervalcvar_regen_dmgdelay
new cRegenAddFloat:cRegenIntervalFloat:cRegenDmgDelay

public plugin_init()
{
    
register_plugin("ZP Zombie Regen V2""1.0.0""yokomo")
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
RegisterHam(Ham_Spawn"player""ham_spawn_post"1)
    
RegisterHam(Ham_TakeDamage"player""ham_takedamage")
    
    
cvar_regen_add register_cvar("zp_regen_add""200")
    
cvar_regen_interval register_cvar("zp_regen_interval""1.0")
    
cvar_regen_dmgdelay register_cvar("zp_regen_dmg_delay""2.5")
}

public 
client_putinserver(id)
{
    
MarkUserConnected(id)
}

public 
client_disconnect(id)
{
    
ClearUserConnected(id)
    
ClearUserAlive(id)
    
ClearUserZombie(id)
    
ClearUserBlock(id)
}

public 
event_round_start()
{
    
g_endround false
    
    cRegenAdd 
get_pcvar_num(cvar_regen_add)
    
cRegenInterval get_pcvar_float(cvar_regen_interval)
    
cRegenDmgDelay get_pcvar_float(cvar_regen_dmgdelay)
}

public 
zp_round_ended()
{
    
g_endround true
}

public 
ham_spawn_post(id)
{
    if(
is_user_alive(id))
    {
        
MarkUserAlive(id)
        
ClearUserZombie(id)
    }
}

public 
ham_takedamage(iVictimiInflictoriAttackerFloat:fDamageiDmgBits)
{
    if(
IsUserConnected(iVictim) && IsUserAlive(iVictim) && IsUserZombie(iVictim))
    {
        
MarkUserBlock(iVictim)
        
        
remove_task(iVictim+TASK_BLOCK_REGEN)
        
set_task(cRegenDmgDelay"RemoveBlockRegen"iVictim+TASK_BLOCK_REGEN)
    }
}

public 
RemoveBlockRegen(taskid)
{
    if(
IsUserConnected(ID_BLOCK_REGEN) && IsUserAlive(ID_BLOCK_REGEN) && IsUserZombie(ID_BLOCK_REGEN))
    {
        
ClearUserBlock(ID_BLOCK_REGEN)
        
        
remove_task(ID_BLOCK_REGEN+TASK_REGENERATION)
        
set_task(cRegenInterval"RegenHpProcess"ID_BLOCK_REGEN+TASK_REGENERATION)
    }
}

public 
RegenHpProcess(taskid)
{
    if(
IsUserBlock(ID_REGEN))
        return
        
    if(!
g_endround && IsUserAlive(ID_REGEN) && IsUserZombie(ID_REGEN))
    {
        if (
g_maxhealth[ID_REGEN] != -1)
        {
            new 
iCurHealth pev(ID_REGENpev_health)
            
            if (
iCurHealth g_maxhealth[ID_REGEN])
            {
                new 
iNewHealth iCurHealth cRegenAdd
                
                
if(iNewHealth g_maxhealth[ID_REGEN])
                    
set_pev(ID_REGENpev_healthg_maxhealth[ID_REGEN])
                else
                    
set_pev(ID_REGENpev_healthiNewHealth)
                    
                
set_task(cRegenInterval"RegenHpProcess"ID_REGEN+TASK_REGENERATION)
            }
        }
    }
}

public 
zp_user_humanized_post(id)
{
    
ClearUserZombie(id)
}

public 
zp_user_infected_post(idinfectornemesis)
{
    if(!
nemesis)
    {
        
MarkUserZombie(id)
        
g_maxhealth[id] = zp_get_zombie_maxhealth(id)
    }

EDIT:
I reupdated the code again. I removed a CVar. It's useless.

Last edited by Excalibur.007; 06-17-2011 at 00:00.
Excalibur.007 is offline
jc980
Veteran Member
Join Date: Jan 2010
Location: God is with us...
Old 06-17-2011 , 06:08   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #6

FAKEMETA FTW!!!!!
__________________
jc980 is offline
DarkNill
Junior Member
Join Date: Dec 2009
Old 06-18-2011 , 12:26   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #7

the original version was better, with no effects!
__________________
DarkNill is offline
Send a message via ICQ to DarkNill Send a message via Skype™ to DarkNill
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 09-18-2011 , 01:37   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #8

@Moderator
Please lock this thread and move it into Subplugin Submissions
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
mekkinha
Member
Join Date: Dec 2010
Old 10-07-2011 , 11:39   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #9

add sprite man
mekkinha is offline
tei1995
Senior Member
Join Date: Feb 2011
Location: VietNam
Old 10-08-2011 , 03:14   Re: [ZP] Addon Simple Zombie HP Regen
Reply With Quote #10

Use TE_SPRITE msg when regen.
__________________

Hatsune Miku~
tei1995 is offline
Old 02-29-2012, 18:54
mekkinha
This message has been deleted by mekkinha.
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 20:09.


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