MakoVote: chance of forced ZM round
This commit is contained in:
parent
28a41a57d6
commit
809a89c8ae
@ -20,7 +20,8 @@ public Plugin myinfo =
|
||||
|
||||
bool g_bVoteFinished = true;
|
||||
bool g_bIsRevote = false;
|
||||
bool bStartVoteNextRound = false;
|
||||
bool g_bStartVoteNextRound = false;
|
||||
bool g_bPlayedZM = false;
|
||||
|
||||
bool g_bOnCooldown[NUMBEROFSTAGES];
|
||||
static char g_sStageName[NUMBEROFSTAGES][32] = {"Extreme 2", "Extreme 2 (Heal + Ultima)", "Extreme 3 (ZED)", "Extreme 3 (Hellz)", "Race Mode", "Zombie Mode"};
|
||||
@ -30,22 +31,44 @@ Handle g_VoteMenu = INVALID_HANDLE;
|
||||
Handle g_StageList = INVALID_HANDLE;
|
||||
Handle g_CountdownTimer = INVALID_HANDLE;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "MakoVoteSystem",
|
||||
author = "Neon",
|
||||
description = "MakoVoteSystem",
|
||||
version = "1.3",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnPluginStart()
|
||||
{
|
||||
RegServerCmd("sm_makovote", Command_StartVote);
|
||||
HookEvent("round_start", OnRoundStart);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnMapStart()
|
||||
{
|
||||
VerifyMap();
|
||||
|
||||
bStartVoteNextRound = false;
|
||||
g_bStartVoteNextRound = false;
|
||||
g_bPlayedZM = false;
|
||||
|
||||
for (int i = 0; i < NUMBEROFSTAGES; i++)
|
||||
g_bOnCooldown[i] = false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action VerifyMap()
|
||||
{
|
||||
char currentMap[64];
|
||||
@ -66,6 +89,9 @@ public Action VerifyMap()
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnEntitySpawned(int iEntity, const char[] sClassname)
|
||||
{
|
||||
if (!IsValidEntity(iEntity) || g_bVoteFinished)
|
||||
@ -78,12 +104,34 @@ public void OnEntitySpawned(int iEntity, const char[] sClassname)
|
||||
AcceptEntityInput(iEntity, "Kill");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
if (bStartVoteNextRound)
|
||||
if (g_bStartVoteNextRound)
|
||||
{
|
||||
g_bVoteFinished = false;
|
||||
if (!g_bPlayedZM)
|
||||
{
|
||||
CPrintToChatAll("{green}[Mako Vote] {white}ZM has not been played yet. Rolling the dice...");
|
||||
if (GetRandomInt(1, 100) <= 35)
|
||||
{
|
||||
CPrintToChatAll("{green}[Mako Vote] {white}Result: ZM, restarting round.");
|
||||
ServerCommand("sm_stage zm");
|
||||
g_bVoteFinished = true;
|
||||
g_bStartVoteNextRound = false;
|
||||
g_bPlayedZM = true;
|
||||
CS_TerminateRound(1.0, CSRoundEnd_GameStart, false);
|
||||
return;
|
||||
}
|
||||
CPrintToChatAll("{green}[Mako Vote] {white}Result: Normal vote");
|
||||
}
|
||||
else
|
||||
CPrintToChatAll("{green}[Mako Vote] {white}ZM already has been played. Starting normal vote.");
|
||||
|
||||
g_CountdownTimer = CreateTimer(1.0, StartVote, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
bStartVoteNextRound = false;
|
||||
g_bStartVoteNextRound = false;
|
||||
}
|
||||
|
||||
if (!(g_bVoteFinished))
|
||||
@ -192,6 +240,9 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void GenerateArray()
|
||||
{
|
||||
int iBlockSize = ByteCountToCells(PLATFORM_MAX_PATH);
|
||||
@ -214,6 +265,9 @@ public void GenerateArray()
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action Command_StartVote(int args)
|
||||
{
|
||||
int iCurrentStage = GetCurrentStage();
|
||||
@ -221,6 +275,9 @@ public Action Command_StartVote(int args)
|
||||
if (iCurrentStage > 0)
|
||||
g_bOnCooldown[iCurrentStage] = true;
|
||||
|
||||
if (iCurrentStage == 5)
|
||||
g_bPlayedZM = true;
|
||||
|
||||
int iOnCD = 0;
|
||||
for (int i = 0; i < NUMBEROFSTAGES; i++)
|
||||
{
|
||||
@ -234,13 +291,15 @@ public Action Command_StartVote(int args)
|
||||
g_bOnCooldown[i] = false;
|
||||
}
|
||||
|
||||
g_bVoteFinished = false;
|
||||
GenerateArray();
|
||||
bStartVoteNextRound = true;
|
||||
g_bStartVoteNextRound = true;
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action StartVote(Handle timer)
|
||||
{
|
||||
static int iCountDown = 5;
|
||||
@ -255,6 +314,9 @@ public Action StartVote(Handle timer)
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void InitiateVote()
|
||||
{
|
||||
if(IsVoteInProgress())
|
||||
@ -291,6 +353,9 @@ public void InitiateVote()
|
||||
VoteMenuToAll(g_VoteMenu, 20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public int Handler_MakoVoteMenu(Handle menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
switch(action)
|
||||
@ -310,6 +375,9 @@ public int Handler_MakoVoteMenu(Handle menu, MenuAction action, int param1, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public int MenuHandler_NotifyPanel(Menu hMenu, MenuAction iAction, int iParam1, int iParam2)
|
||||
{
|
||||
switch (iAction)
|
||||
|
Loading…
Reference in New Issue
Block a user