Skip to content

Commit 84f66f7

Browse files
committed
Fix ready / unready forwards and add autoready feature
1 parent 2df6ccc commit 84f66f7

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

549 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/player.inc

Lines changed: 11 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,13 @@ 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+
}
6067
}
6168

6269
#define AFK_DURATION 15.0

addons/sourcemod/scripting/readyup/setup.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ 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+
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);
54+
5455
// game
5556
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);
5657
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);

0 commit comments

Comments
 (0)