summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gem_halftime_teamswap.sp
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-11-13 15:15:03 +0100
committernavewindre <nw@moneybot.cc>2023-11-13 15:15:03 +0100
commitdc48762943a04f1cdb9010979e20ca74c6d82e5e (patch)
tree7e16628adbbcccfabe171fd68f20d9deeee7e9b9 /sourcemod/scripting/gem_halftime_teamswap.sp
parentc10e77724861c9fefc6d3ea0846751ff4f9dcb98 (diff)
remove block ljs, sv_enablebunnyhopping 0 stats, better restartgame fix
Diffstat (limited to 'sourcemod/scripting/gem_halftime_teamswap.sp')
-rw-r--r--sourcemod/scripting/gem_halftime_teamswap.sp35
1 files changed, 7 insertions, 28 deletions
diff --git a/sourcemod/scripting/gem_halftime_teamswap.sp b/sourcemod/scripting/gem_halftime_teamswap.sp
index bed6959..9fdc3b3 100644
--- a/sourcemod/scripting/gem_halftime_teamswap.sp
+++ b/sourcemod/scripting/gem_halftime_teamswap.sp
@@ -68,7 +68,6 @@ public OnPluginStart(){
CreateConVar("sm_halftime_teamswitch_version", PLUGIN_VERSION, "Halftime teamswitch version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("round_start", Event_RoundStart);
HookEvent("round_end", Event_RoundEnd);
- HookEvent("restart_round_(1_second)", Event_RestartRound );
g_h_moneyReset = CreateConVar("sm_halftime_money_reset", "1", "If weapons should be removed and money reset to mp_startmoney");
g_h_mp_startmoney = FindConVar("mp_startmoney");
@@ -85,17 +84,6 @@ public OnPluginStart(){
}
-public Event_RestartRound( Handle: event, const String:name[], bool dontBroadcast ) {
- g_CtScore = 0;
- g_TScore = 0;
-
- g_halftime_do_resetMoney = true;
- g_roundCount = 0;
-
- SetTeamScore(CS_TEAM_CT, g_CtScore);
- SetTeamScore(CS_TEAM_T, g_TScore);
-}
-
// RoundStart gets the maptime
// Checks to see if halftime has passed, if not then make sure halftime is 0
// Setting halftime false here as well since in some occasions when extending map
@@ -105,12 +93,14 @@ public Event_RoundStart (Handle:event, const String:name[], bool:dontBroadcast)
new wepIdx;
new playerTeam;
- g_roundCount++;
- //LogMessage(">>> Increasing roundCount %d<<<", g_roundCount);
-
GetMapTimeLimit(mapTime);
mapTime=mapTime*60;
+ g_CtScore = GetTeamScore(CS_TEAM_CT);
+ g_TScore = GetTeamScore(CS_TEAM_T);
+
+ g_roundCount = g_CtScore + g_TScore;
+
if (g_halftime_do_resetMoney) {
for (new client=1; client<=GetMaxClients(); client++)
{
@@ -140,13 +130,11 @@ public Event_RoundStart (Handle:event, const String:name[], bool:dontBroadcast)
g_halftime_do_resetMoney = false;
}
-// At Round end we check if time left of the map is passed halftime.
-// If so and we have not already switched teams before, switch teams and then set halftime to 1
public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
{
new mapTimeLeft;
new bool:doSwap = false;
-// new CTScore, TScore;
+
new reason = GetEventInt(event, "reason");
new winner = GetEventInt(event, "winner");
@@ -196,13 +184,7 @@ public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
Call_StartForward(g_f_on_ht);
Call_Finish();
- //LogMessage(">>> Halftime, switching players to oposite team <<<");
-
- //LogToGame(">>>>>Setting halftime to true<<<<<");
halftime = true;
-
- //Loop through all players and see if they are in game and that they are on a team
- //LogMessage("Players to switch: %d", GetMaxClients());
for (new i=1; i<=GetMaxClients(); i++)
{
if (IsClientInGame (i) && IsClientConnected(i)) {
@@ -233,10 +215,7 @@ public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
//LogMessage("Player %d is *NOT* InGame", i);
}
}
- //CTScore = GetTeamScore(CS_TEAM_CT);
- //TScore = GetTeamScore(CS_TEAM_T);
- //SetTeamScore(CS_TEAM_CT, TScore);
- //SetTeamScore(CS_TEAM_T, CTScore);
+
new tmp;
tmp = g_CtScore;
g_CtScore = g_TScore;