Skip to content

Commit 6fd83ec

Browse files
committed
Update autopause (compatibility)
- Use updated and simpler Left4DHooks setup.
1 parent b90bf9c commit 6fd83ec

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

-20 Bytes
Binary file not shown.

addons/sourcemod/scripting/autopause.sp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public Plugin myinfo =
3939
name = "L4D2 Auto-pause",
4040
author = "Darkid, Griffin, StarterX4, Forgetest, J.",
4141
description = "When a player disconnects due to crash, automatically pause the game. When they rejoin, give them a correct spawn timer.",
42-
version = "2.3",
42+
version = "2.4",
4343
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
4444
}
4545

@@ -190,23 +190,22 @@ void Event_PlayerTeam(Event hEvent, char[] sEventName, bool dontBroadcast)
190190
DebugLog(sDebugMessage);
191191
}
192192
}
193-
else if (newTeam == L4D_TEAM_INFECTED)
193+
else if (newTeam == L4D_TEAM_INFECTED)
194194
{
195195
float fSpawnTime;
196196

197-
if (crashedPlayers.GetValue(sAuthId, fSpawnTime))
197+
if (crashedPlayers.GetValue(sAuthId, fSpawnTime))
198198
{
199-
CountdownTimer CTimer_SpawnTimer = L4D2Direct_GetSpawnTimer(client);
200-
CTimer_Start(CTimer_SpawnTimer, fSpawnTime);
199+
L4D_SetPlayerSpawnTime(client, fSpawnTime, true);
201200
crashedPlayers.Remove(sAuthId);
202201

203202
if (convarDebug.BoolValue)
204203
{
205204
Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Player %s rejoined the infected, set spawn timer to %f.", sEventName, sAuthId, fSpawnTime);
206205
DebugLog(sDebugMessage);
207206
}
208-
}
209-
207+
}
208+
210209
teamPlayers.SetValue(sAuthId, newTeam);
211210

212211
if (convarDebug.BoolValue)
@@ -282,13 +281,12 @@ void Event_PlayerDisconnect(Event hEvent, char[] sEventName, bool dontBroadcast)
282281
}
283282

284283
int team;
285-
if (teamPlayers.GetValue(sAuthId, team) && team == L4D_TEAM_INFECTED)
284+
if (teamPlayers.GetValue(sAuthId, team) && team == L4D_TEAM_INFECTED)
286285
{
287-
CountdownTimer CTimer_SpawnTimer = L4D2Direct_GetSpawnTimer(client);
288-
if (CTimer_SpawnTimer != CTimer_Null)
289-
{
290-
float fTimeLeft = CTimer_GetRemainingTime(CTimer_SpawnTimer);
286+
float fTimeLeft = L4D_GetPlayerSpawnTime(client);
291287

288+
if (fTimeLeft > 0.0)
289+
{
292290
if (convarDebug.BoolValue)
293291
{
294292
Format(sDebugMessage, sizeof(sDebugMessage), "[AutoPause (%s)] Player %s left the game with %f time until spawn.", sEventName, sAuthId, fTimeLeft);

0 commit comments

Comments
 (0)