Skip to content

Commit

Permalink
add convar to change permission to use pause command & fix `matchzy_u…
Browse files Browse the repository at this point in the history
…se_pause_command_for_tactical_pause` convar not working
  • Loading branch information
Cruze03 committed Nov 12, 2024
1 parent 4e2cac9 commit 9674c1e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions ConfigConvars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public partial class MatchZy

public FakeConVar<bool> smokeColorEnabled = new("matchzy_smoke_color_enabled", "Whether player-specific smoke color is enabled or not. Default: false", false);
public FakeConVar<bool> techPauseEnabled = new("matchzy_enable_tech_pause", "Whether .tech command is enabled or not. Default: true", true);
public FakeConVar<string> techPausePermission = new("matchzy_tech_pause_flag", "Flag required to use tech pause", "");
public FakeConVar<int> techPauseDuration = new("matchzy_tech_pause_duration", "Tech pause duration in seconds. Default value: 300", 300);

public FakeConVar<int> maxTechPausesAllowed = new("matchzy_max_tech_pauses_allowed", " Max tech pauses allowed. Default value: 2", 2);
Expand Down
13 changes: 13 additions & 0 deletions Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,19 @@ public bool IsTeamSwapRequired()

private void PauseMatch(CCSPlayerController? player, CommandInfo? command)
{
if (!techPauseEnabled.Value && player != null)
{
PrintToPlayerChat(player, Localizer["matchzy.ready.techpausenotenabled"]);
return;
}
if(!string.IsNullOrEmpty(techPausePermission.Value))
{
if (!IsPlayerAdmin(player, "css_pause", techPausePermission.Value))
{
SendPlayerNotAdminMessage(player);
return;
}
}
if (isMatchLive && isPaused)
{
// ReplyToUserCommand(player, "Match is already paused!");
Expand Down
4 changes: 4 additions & 0 deletions cfg/MatchZy/config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ matchzy_use_pause_command_for_tactical_pause false
// Default value: true
matchzy_enable_tech_pause true

// Flag required to use tech pause. Blank for anyone
// Default value: ""
matchzy_tech_pause_flag ""

// Tech pause duration in seconds. Set -1 to keep it infinite.
// Default value: 300
matchzy_tech_pause_duration 300
Expand Down

0 comments on commit 9674c1e

Please sign in to comment.