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

[ZP] Little help in editing additional plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 01-15-2010 , 07:17   [ZP] Little help in editing additional plugin.
Reply With Quote #1

Hello.

Long time ago Mercylezz (zombie plague coder) did this plugin. Since he hasnt been seen for half a year now I'm writing here. It just adds additional zombies to each simple infection round (not multi-infection round!). Now here's a problem: it makes static ammount of players to turn into zombies. I'd like to ask if anyone could make it so this plugin would add additional zombies in % depending on players count currently on server, like some ratio or whatever (for example zp_bonus_zombies 0.2 -> 20% of players are becoming additional zombies).

Do not tell me about multiple infection, it's completely different thing.

Thank you.

UPD: Oh yeah, I forgot: it would be cool to have also some kind of a minimum players required for this plugin to work. Like if current players count is less than X, then plugin will do nothing.

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

new g_maxplayerscvar_additionalzombies

public plugin_init()
{
    
register_plugin("[ZP] Multi Infection""0.1""MeRcyLeZZ")
    
    
g_maxplayers get_maxplayers()
    
    
// How many additional players should be infected at start
    
cvar_additionalzombies register_cvar("zp_additional_zombies""1")
}

public 
zp_round_started(gamemode)
{
    
// Normal infection modes only
    
if (gamemode != MODE_INFECTION)
        return;
    
    
// Figure out how many players should we infect (one human should be left alive!)
    
new idiZombiesiMaxZombies min(get_pcvar_num(cvar_additionalzombies), fnGetAlive()-2)
    
    
// Randomly turn iMaxZombies players into zombies
    
while (iZombies iMaxZombies)
    {
        
// Keep looping through all players
        
if (++id g_maxplayersid 1
        
        
// Dead or already a zombie
        
if (!is_user_alive(id) || zp_get_user_zombie(id))
            continue;
        
        
// Random chance
        
if (random_num(010) == 0)
        {
            
// Turn into a zombie
            
zp_infect_user(id)
            
iZombies++
        }
    }
}

// Returns alive players count
fnGetAlive()
{
    new 
iAliveid
    
    
for (id 1id <= g_maxplayersid++)
    {
        if (
is_user_alive(id))
            
iAlive++
    }
    
    return 
iAlive;


Last edited by Hammerfallerz; 01-15-2010 at 07:21.
Hammerfallerz is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 01-15-2010 , 19:32   Re: [ZP] Little help in editing additional plugin.
Reply With Quote #2

Nevermind, did myself.
Hammerfallerz is offline
Reply


Thread Tools
Display Modes

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 01:29.


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