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_maxplayers, cvar_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 id, iZombies, iMaxZombies = 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_maxplayers) id = 1
// Dead or already a zombie
if (!is_user_alive(id) || zp_get_user_zombie(id))
continue;
// Random chance
if (random_num(0, 10) == 0)
{
// Turn into a zombie
zp_infect_user(id)
iZombies++
}
}
}
// Returns alive players count
fnGetAlive()
{
new iAlive, id
for (id = 1; id <= g_maxplayers; id++)
{
if (is_user_alive(id))
iAlive++
}
return iAlive;
}