Skip to content

Commit c299b61

Browse files
authored
Fix ready / unready forwards and add autoready feature (#911)
* Fix ready / unready forwards and add autoready feature * autoready: added missing live countdown call * autoready: disable unready command
1 parent 2df6ccc commit c299b61

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed
576 Bytes
Binary file not shown.

addons/sourcemod/scripting/readyup.sp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#undef REQUIRE_PLUGIN
1010
#include <caster_system>
1111

12-
#define PLUGIN_VERSION "10.2.5"
12+
#define PLUGIN_VERSION "10.2.6"
1313

1414
public Plugin myinfo =
1515
{
@@ -74,7 +74,7 @@ ConVar
7474
// Plugin Cvars
7575
ConVar
7676
// basic
77-
l4d_ready_enabled, l4d_ready_cfg_name, l4d_ready_server_cvar, l4d_ready_max_players,
77+
l4d_ready_enabled, l4d_ready_cfg_name, l4d_ready_server_cvar, l4d_ready_max_players, l4d_ready_autoready,
7878
// game
7979
l4d_ready_disable_spawns, l4d_ready_survivor_freeze,
8080
// sound

addons/sourcemod/scripting/readyup/command.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ Action Ready_Cmd(int client, int args)
3838

3939
Action Unready_Cmd(int client, int args)
4040
{
41+
if (l4d_ready_autoready.BoolValue)
42+
{
43+
return Plugin_Handled;
44+
}
45+
4146
if (inReadyUp && client)
4247
{
4348
bool hasflag = CheckCommandAccess(client, "sm_ban", ADMFLAG_BAN); // Check for specific admin flag

addons/sourcemod/scripting/readyup/player.inc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ bool SetPlayerReady(int client, bool ready)
2222

2323
if (prev && !ready)
2424
{
25-
if (g_hPlayerReadyForward.FunctionCount)
25+
if (g_hPlayerUnreadyForward.FunctionCount)
2626
{
27-
Call_StartForward(g_hPlayerReadyForward);
27+
Call_StartForward(g_hPlayerUnreadyForward);
2828
Call_PushCell(client);
2929
Call_Finish();
3030
}
3131
}
3232
else if (!prev && ready)
3333
{
34-
if (g_hPlayerUnreadyForward.FunctionCount)
34+
if (g_hPlayerReadyForward.FunctionCount)
3535
{
36-
Call_StartForward(g_hPlayerUnreadyForward);
36+
Call_StartForward(g_hPlayerReadyForward);
3737
Call_PushCell(client);
3838
Call_Finish();
3939
}
@@ -57,6 +57,18 @@ bool SetPlayerHiddenPanel(int client, bool hidden)
5757
void SetButtonTime(int client)
5858
{
5959
buttonTime[client] = GetEngineTime();
60+
61+
int iPassTime = RoundToFloor(GetGameTime() - fStartTimestamp);
62+
63+
if (IsPlayer(client) && inReadyUp && l4d_ready_autoready.BoolValue && iPassTime >= l4d_ready_autoready.IntValue)
64+
{
65+
SetPlayerReady(client, true);
66+
67+
if (CheckFullReady())
68+
{
69+
InitiateLiveCountdown();
70+
}
71+
}
6072
}
6173

6274
#define AFK_DURATION 15.0

addons/sourcemod/scripting/readyup/setup.inc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void SetupConVars()
5050
l4d_ready_cfg_name = CreateConVar("l4d_ready_cfg_name", "", "Configname to display on the ready-up panel", FCVAR_NOTIFY|FCVAR_PRINTABLEONLY);
5151
l4d_ready_server_cvar = CreateConVar("l4d_ready_server_cvar", "sn_main_name", "ConVar to retrieve the server name for displaying on the ready-up panel", FCVAR_NOTIFY|FCVAR_PRINTABLEONLY);
5252
l4d_ready_max_players = CreateConVar("l4d_ready_max_players", "12", "Maximum number of players to show on the ready-up panel.", FCVAR_NOTIFY, true, 0.0, true, MAXPLAYERS+1.0);
53-
53+
5454
// game
5555
l4d_ready_disable_spawns = CreateConVar("l4d_ready_disable_spawns", "0", "Prevent SI from having spawns during ready-up", FCVAR_NOTIFY, true, 0.0, true, 1.0);
5656
l4d_ready_survivor_freeze = CreateConVar("l4d_ready_survivor_freeze", "1", "Freeze the survivors during ready-up. When unfrozen they are unable to leave the saferoom but can move freely inside", FCVAR_NOTIFY, true, 0.0, true, 1.0);
@@ -72,7 +72,8 @@ void SetupConVars()
7272
l4d_ready_autostart_min = CreateConVar("l4d_ready_autostart_min", "0.25", "Percent of max players (Versus = 8) in game to allow auto-start to proceed.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
7373
l4d_ready_unbalanced_start = CreateConVar("l4d_ready_unbalanced_start", "0", "Allow game to go live when teams are not full.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
7474
l4d_ready_unbalanced_min = CreateConVar("l4d_ready_unbalanced_min", "2", "Minimum of players in each team to allow a unbalanced start.", FCVAR_NOTIFY, true, 0.0);
75-
75+
l4d_ready_autoready = CreateConVar("l4d_ready_autoready", "0", "Automatically ready up a player after after <value> seconds if they are not afk (0 = disabled).", FCVAR_NOTIFY, true, 0.0);
76+
7677
// game convars
7778
director_no_specials = FindConVar("director_no_specials");
7879
god = FindConVar("god");

0 commit comments

Comments
 (0)