View Single Post
Author Message
SergiCruz
Senior Member
Join Date: Mar 2012
Location: Andalucía, España
Old 05-23-2015 , 16:15   [ZP4.3] [SOLVED] Block infection and call takedamage
Reply With Quote #1

I'm making a plugin for a "more realistic infection" for zp4.3, so I need to avoid instant infection. I want zombies to kill humans, and then the humans will respawn as zombies. (I know it would be much easier with 5.0, in fact it's already done, but I prefer this older version)

I tried this

PHP Code:
public zp_user_infect_attempt(idinfectornemesis)
{
    
// g_is_infection : True when it's infection mode or multi infection mode
    // g_justDeath[id]: True when id has just been killed by a zombie. That allows to infect a human after his spawn
    
if(g_is_infection && !g_justDeath[id])
            return 
ZP_PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;

and that correctly blocks infection, but no damage it's taken. So, I decided to call TakeDamage manually:

PHP Code:
public zp_user_infect_attempt(idinfectornemesis)
{
    if(
g_is_infection && first_zombies && !g_justDeath[id]) {
        
        new 
button pev(infectorpev_button)
        if(
button == IN_ATTACK){
            
ExecuteHamB(Ham_TakeDamageidinfectorinfectorrandom_float(10.0,50.0), DMG_SLASH)
            return 
ZP_PLUGIN_HANDLED;
        }
        else if(
button == IN_ATTACK2){
            
ExecuteHamB(Ham_TakeDamageidinfectorinfectorrandom_float(50.0120.0), DMG_SLASH)
            return 
ZP_PLUGIN_HANDLED;
        }
        else    return 
ZP_PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;

but this is shitty, and it's making a mess with ammopacks rewards.

Can someone help me with this? I think I will need to modify the zombie_plague40.sma directly, but I still hope to be able to do it with a plugin.

Thanks in advance
__________________
PodBot waypointer. Feel free to ask for waypoints for zm_ maps.

Last edited by SergiCruz; 05-24-2015 at 06:41. Reason: Solved
SergiCruz is offline
Send a message via MSN to SergiCruz