Raised This Month: $ Target: $400
 0% 

restore zombies healt


Post New Thread Reply   
 
Thread Tools Display Modes
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-20-2008 , 11:43   Re: restore zombies healt
Reply With Quote #11

Try this one. If it works, I'll make this a sub-plugin for Zombie Plague.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
 
#define TASK_REGENERATION 1024
 
new g_Statusg_Timeg_Amountg_ZombiePlague;
 
public 
plugin_init()
{
        
register_plugin("ZP Regeneration""1.0""hleV");
 
        
g_Status register_cvar("zp_regeneration""1");
        
g_Time register_cvar("zp_regen_time""1");
        
g_Amount register_cvar("zp_regen_amount""10");
 
        
register_event("Damage""SetRegeneration""be""2>0");
 
        
g_ZombiePlague get_cvar_pointer("zp_on");
}
 
public 
SetRegeneration(Client)
{
        if (!
g_ZombiePlague || !get_pcvar_num(g_Status) || !is_user_connected(Client) || !is_user_alive(Client) || !zp_get_user_zombie(Client))
                return;
 
        if (
get_user_health(Client) < zp_get_zombie_maxhealth(Client))
                
set_task(get_pcvar_float(g_Time), "Regenerate"Client TASK_REGENERATION__"b");
}
 
public 
Regenerate(Task)
{
        if (!
g_ZombiePlague || !get_pcvar_num(g_Status))
                return;
 
        new 
Client Task TASK_REGENERATION;
        new 
Health get_user_health(Client);
 
        if (!
is_user_connected(Client) || !is_user_alive(Client))
                return;
 
        new 
NeededHealth zp_get_zombie_maxhealth(Client) - Health;
 
        if (
NeededHealth <= get_pcvar_num(g_Amount))
        {
                
set_pev(Clientpev_healthHealth float(NeededHealth));
                
remove_task(Client TASK_REGENERATION);
 
                return;
        }
 
        
set_pev(Clientpev_healthHealth get_pcvar_float(g_Amount));

__________________

Last edited by hleV; 10-20-2008 at 14:45. Reason: Sorry for double-post. Forgot that I already made a post here today.
hleV is offline
MEN
Junior Member
Join Date: Nov 2007
Old 10-20-2008 , 12:16   Re: restore zombies healt
Reply With Quote #12

hleV Huge human thanks! The plug-in works perfectly well!
MEN is offline
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 15:51.


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