FunMode: get rid of playerclasses and round restart

This commit is contained in:
BotoX 2018-08-20 16:53:21 +02:00
parent 64f4f98a8a
commit 5e523fdab7

View File

@ -191,7 +191,6 @@ public void OnClientPutInServer(int client)
Panel hNotifyPanel = new Panel(GetMenuStyleHandle(MenuStyle_Radio));
hNotifyPanel.DrawItem("Freezenades vs. Throwing Knives Mode is enabled on this map.", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("", ITEMDRAW_SPACER);
hNotifyPanel.DrawItem("There are different classes enabled than usual. Check them out by typing !zclass.", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("Watch out for zombies spawning in between humans!", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("", ITEMDRAW_SPACER);
hNotifyPanel.DrawItem("As a Human you have one Freezenade (Smoke). Use it wisely!", ITEMDRAW_RAWLINE);
@ -226,17 +225,6 @@ public Action EventHook_PlayerSpawnPost(Handle hTimer, int serial)
int ent = GivePlayerItem(client, "weapon_smokegrenade");
EquipPlayerWeapon(client, ent);
//PrintToChatAll("1. %N gets %d", client, ent);
char sHumanClassName[64];
ZRT_GetClientClassSectionName(client, sHumanClassName, sizeof(sHumanClassName));
if (StrEqual(sHumanClassName, "freeze_human"))
{
ent = GivePlayerItem(client, "weapon_smokegrenade"); // needs ammo_smokegrenade_max 2
EquipPlayerWeapon(client, ent);
// PrintToChatAll("2. %N gets %d", client, ent);
}
}
int MenuHandler_NotifyPanel(Menu hMenu, MenuAction iAction, int iParam1, int iParam2)
@ -334,10 +322,9 @@ public void ZR_OnClientInfected(int client, int attacker, bool bMotherInfect, bo
public void TeamManager_WarmupEnd()
{
if (!g_bInWarmup || g_bEnabled)
return;
CreateTimer(1.0, Timer_OnWarmupEnd, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
g_bInWarmup = false;
if (!g_bEnabled)
CreateTimer(1.0, Timer_OnWarmupEnd, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
public Action OnPlayerRunCmd(int client, int &buttons)
@ -479,18 +466,20 @@ public int MenuHandler_FunModeVote(Menu menu, MenuAction action, int param1, int
}
else
{
PrintToChatAll("[SM] %t", "Vote Successful", RoundToNearest(100.0 * percent), totalVotes);
g_bEnabled = true;
ServerCommand("exec funmodeload");
g_bInWarmup = false;
g_bEnabled = true;
PrintToChatAll("[SM] %t", "Vote Successful", RoundToNearest(100.0 * percent), totalVotes);
PrintCenterTextAll("FunMode vote passed!");
CreateTimer(1.0, Timer_RestartRound, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
if (strcmp(item, VOTE_NO) == 0 || strcmp(item, VOTE_YES) == 0)
// Give all CTs smokegrenades
for (int i = 1; i <= MaxClients; i++)
{
strcopy(item, sizeof(item), display);
if (!IsClientInGame(i) || GetClientTeam(i) != CS_TEAM_CT)
continue;
int ent = GivePlayerItem(i, "weapon_smokegrenade");
EquipPlayerWeapon(i, ent);
}
}
}
@ -498,43 +487,6 @@ public int MenuHandler_FunModeVote(Menu menu, MenuAction action, int param1, int
return 0;
}
public Action Timer_RestartRound(Handle hThis)
{
static int iCountDown = 0;
if (iCountDown++ >= 3)
{
iCountDown = 0;
float fDelay = 3.0;
CS_TerminateRound(fDelay, CSRoundEnd_GameStart, false);
CreateTimer(2.0, Timer_FireOnClientPutInServer, _, TIMER_FLAG_NO_MAPCHANGE);
return Plugin_Stop;
}
PrintCenterTextAll("FunMode vote passed, restarting game in: %d", 4 - iCountDown);
return Plugin_Continue;
}
public Action Timer_FireOnClientPutInServer(Handle hThis)
{
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
continue;
int iDefaultClassZM = ZR_GetClassByName("Funmode Zombie 1");
ZR_SelectClientClass(i, iDefaultClassZM);
int iDefaultClassHuman = ZR_GetClassByName("Funmode Human 1");
ZR_SelectClientClass(i, iDefaultClassHuman);
OnClientPutInServer(i);
}
return Plugin_Handled;
}
public Action Timer_UpdateKnives(Handle hThis)
{
if (!g_bEnabled)