AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [ZP] Little help in editing additional plugin. (https://forums.alliedmods.net/showthread.php?t=115618)

Hammerfallerz 01-15-2010 07:17

[ZP] Little help in editing additional plugin.
 
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;



Hammerfallerz 01-15-2010 19:32

Re: [ZP] Little help in editing additional plugin.
 
Nevermind, did myself.


All times are GMT -4. The time now is 00:31.

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