Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
|
02-08-2016
, 03:54
Re: [ZP43] Swarm mode only 1 person infected in half server
|
#13
|
Quote:
Originally Posted by New and Clueless
it compiled no errors this time but still only 1 person got infected
actually 0 people got infected, so it was only all CTs
|
I'm pretty sure you didn't place the code correspondingly.
Code:
else if ((mode == MODE_NONE && (!get_pcvar_num(cvar_preventconsecutive) || g_lastmode != MODE_SWARM) && random_num(1, get_pcvar_num(cvar_swarmchance)) == get_pcvar_num(cvar_swarm) && iPlayersnum >= get_pcvar_num(cvar_swarmminplayers)) || mode == MODE_SWARM)
{
// Swarm Mode
g_swarmround = true
g_lastmode = MODE_SWARM
// Make sure there are alive players on both teams (BUGFIX)
if (!fnGetAliveTs())
{
// Move random player to T team
id = fnGetRandomAlive(random_num(1, iPlayersnum))
remove_task(id+TASK_TEAM)
fm_cs_set_user_team(id, FM_CS_TEAM_T)
fm_user_team_update(id)
}
else if (!fnGetAliveCTs())
{
// Move random player to CT team
id = fnGetRandomAlive(random_num(1, iPlayersnum))
remove_task(id+TASK_TEAM)
fm_cs_set_user_team(id, FM_CS_TEAM_CT)
fm_user_team_update(id)
}
// Turn every T into a zombie
for (id = 1; id <= g_maxplayers; id++)
{
// Not alive
if (!g_isalive[id])
continue;
// Not a Terrorist
if (fm_cs_get_user_team(id) != FM_CS_TEAM_T)
continue;
// Turn into a zombie
zombieme(id, 0, 0, 1, 0)
}
// Play swarm sound
ArrayGetString(sound_swarm, random_num(0, ArraySize(sound_swarm) - 1), sound, charsmax(sound))
PlaySound(sound);
// Show Swarm HUD notice
set_hudmessage(20, 255, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SWARM")
// Mode fully started!
g_modestarted = true
// Round start forward
ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SWARM, 0);
}
-->
Code:
else if ((mode == MODE_NONE && (!get_pcvar_num(cvar_preventconsecutive) || g_lastmode != MODE_SWARM) && random_num(1, get_pcvar_num(cvar_swarmchance)) == get_pcvar_num(cvar_swarm) && iPlayersnum >= get_pcvar_num(cvar_swarmminplayers)) || mode == MODE_SWARM)
{
// Swarm Mode
g_swarmround = true
g_lastmode = MODE_SWARM
// iMaxZombies is rounded up, in case there aren't enough players
iMaxZombies = floatround(iPlayersnum*0.5, floatround_ceil)
iZombies = 0
// 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 (!g_isalive[id] || g_zombie[id])
continue;
// Random chance
if (random_num(0, 1))
{
// Turn into a zombie
zombieme(id, 0, 0, 1, 0)
iZombies++
}
}
// Turn the remaining players into humans
for (id = 1; id <= g_maxplayers; id++)
{
// Only those of them who aren't zombies
if (!g_isalive[id] || g_zombie[id])
continue;
// Switch to CT
if (fm_cs_get_user_team(id) != FM_CS_TEAM_CT) // need to change team?
{
remove_task(id+TASK_TEAM)
fm_cs_set_user_team(id, FM_CS_TEAM_CT)
fm_user_team_update(id)
}
}
// Play swarm sound
ArrayGetString(sound_swarm, random_num(0, ArraySize(sound_swarm) - 1), sound, charsmax(sound))
PlaySound(sound);
// Show Swarm HUD notice
set_hudmessage(20, 255, 20, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_SWARM")
// Mode fully started!
g_modestarted = true
// Round start forward
ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_SWARM, 0);
}
__________________
|
|