Permalink
Browse files

Add round status + native TTT_GetRoundStatus

  • Loading branch information...
Bara committed Oct 20, 2018
1 parent 6dd9129 commit 32ed17f849fd0d4430cdcd440de1b1d866bd63a6
@@ -45,6 +45,14 @@ enum KarmaUpdate
Karma_Subtract
}
enum RoundStatus
{
Round_Inactive = -1,
Round_Warmup,
Round_Active,
Round_Ending
}
enum Collision_Group_t
{
COLLISION_GROUP_NONE = 0,
@@ -468,10 +476,16 @@ native bool TTT_GetLatestVersion(const char[] version, int length);
* - terminate roundd with TTT_TerminateRound
*
* @param status If true, next round will be disabled.
If false, next round will be normal.
* If false, next round will be normal.
*/
native bool TTT_DisableRounds(bool status);
/**
* Returns the current status of the round
*
*/
native RoundStatus TTT_GetRoundStatus();
stock void TTT_GetRoleNameByID(int role, char[] name, int length = ROLE_LENGTH)
{
if (role == TTT_TEAM_INNOCENT)
@@ -320,3 +320,5 @@ Handle g_hWeAreSync = null;
Handle g_hRemainingSync = null;
char g_sLatestVersion[64];
RoundStatus g_iStatus = Round_Inactive;
@@ -51,6 +51,7 @@ void InitNatives()
CreateNative("TTT_TerminateRound", Native_TerminateRound);
CreateNative("TTT_GetLatestVersion", Native_GetLatestVersion);
CreateNative("TTT_DisableRounds", Native_DisableRounds);
CreateNative("TTT_GetRoundStatus", Native_GetRoundStatus);
}
public int Native_IsRoundActive(Handle plugin, int numParams)
@@ -608,3 +609,9 @@ public int Native_DisableRounds(Handle plugin, int numParams)
g_bDisabled = view_as<bool>(GetNativeCell(1));
return g_bDisabled;
}
public int Native_GetRoundStatus(Handle plugin, int numParams)
{
return view_as<int>(g_iStatus);
}
@@ -657,6 +657,7 @@ public Action Event_RoundStartPre(Event event, const char[] name, bool dontBroad
{
if (g_bDisabled)
{
g_iStatus = Round_Inactive;
return;
}
@@ -729,6 +730,8 @@ public Action Event_RoundStartPre(Event event, const char[] name, bool dontBroad
LogMessage("Event_RoundStartPre - 6 (g_hCountdownTimer: %d)", g_hCountdownTimer);
}
g_iStatus = Round_Warmup;
float warmupTime = g_cGraceTime.FloatValue + 5.0;
g_hStartTimer = CreateTimer(warmupTime, Timer_Selection, _, TIMER_FLAG_NO_MAPCHANGE);
@@ -810,6 +813,7 @@ public Action Event_RoundEndPre(Event event, const char[] name, bool dontBroadca
public Action Event_WinPanel(Event event, const char[] name, bool dontBroadcast)
{
g_bRoundEnding = true;
g_iStatus = Round_Ending;
}
public Action Timer_SelectionCountdown(Handle hTimer)
@@ -895,6 +899,8 @@ public Action Timer_Selection(Handle hTimer)
GiveWeaponsOnFailStart();
g_iStatus = Round_Inactive;
return;
}
@@ -970,6 +976,8 @@ public Action Timer_Selection(Handle hTimer)
GiveWeaponsOnFailStart();
g_iStatus = Round_Inactive;
return;
}
@@ -1119,7 +1127,7 @@ public Action Timer_Selection(Handle hTimer)
}
delete aPlayers;
g_iStatus = Round_Active;
LoopValidClients(i)
{
@@ -3156,6 +3164,7 @@ public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcas
public void OnMapEnd()
{
g_bRoundEnding = false;
g_iStatus = Round_Inactive;
if (g_hRoundTimer != null)
{
delete g_hRoundTimer;
@@ -3261,6 +3270,7 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
}
g_bRoundEnding = true;
g_iStatus = Round_Ending;
return Plugin_Changed;
}
@@ -4183,6 +4193,7 @@ void CheckPlayers()
if (g_bDisabled)
{
g_iStatus = Round_Inactive;
return;
}

0 comments on commit 32ed17f

Please sign in to comment.