Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows server to execute CLIENT_AND_SERVER commands #164

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions RetakesPlugin/RetakesPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
[RequiresPermissions("@css/root")]
public void OnCommandMapConfig(CCSPlayerController? player, CommandInfo commandInfo)
{
if (!Helpers.IsValidPlayer(player))
if (player != null && !Helpers.IsValidPlayer(player))
{
return;
}
Expand Down Expand Up @@ -143,7 +143,7 @@
[RequiresPermissions("@css/root")]
public void OnCommandMapConfigs(CCSPlayerController? player, CommandInfo commandInfo)
{
if (player == null || !Helpers.IsValidPlayer(player))
if (player != null && !Helpers.IsValidPlayer(player))
{
return;
}
Expand All @@ -168,7 +168,7 @@
.Replace(".json", "");

commandInfo.ReplyToCommand($"{MessagePrefix}!mapconfig {transformedFile}");
player.PrintToConsole($"{MessagePrefix}!mapconfig {transformedFile}");

Check warning on line 171 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 171 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
}

commandInfo.ReplyToCommand($"{MessagePrefix}A list of available map configs has been outputted above.");
Expand All @@ -179,7 +179,7 @@
[RequiresPermissions("@css/root")]
public void OnCommandForceBombsite(CCSPlayerController? player, CommandInfo commandInfo)
{
if (!Helpers.IsValidPlayer(player))
if (player != null && !Helpers.IsValidPlayer(player))
{
return;
}
Expand All @@ -201,7 +201,7 @@
[RequiresPermissions("@css/root")]
public void OnCommandForceBombsiteStop(CCSPlayerController? player, CommandInfo commandInfo)
{
if (!Helpers.IsValidPlayer(player))
if (player != null && !Helpers.IsValidPlayer(player))
{
return;
}
Expand All @@ -218,7 +218,7 @@
[RequiresPermissions("@css/root")]
public void OnCommandShowSpawns(CCSPlayerController? player, CommandInfo commandInfo)
{
if (!Helpers.IsValidPlayer(player))
if (player != null && !Helpers.IsValidPlayer(player))
{
return;
}
Expand Down Expand Up @@ -626,7 +626,7 @@
}

// TODO: We can make use of sv_human_autojoin_team 3 to prevent needing to do this.
player.ForceTeamTime = 3600.0f;

Check warning on line 629 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 629 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

// Create a timer to do this as it would occasionally fire too early.
AddTimer(1.0f, () =>
Expand Down Expand Up @@ -829,7 +829,7 @@

var player = @event.Userid;

if (!Helpers.IsValidPlayer(player) || !Helpers.IsPlayerConnected(player))

Check warning on line 832 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'player' in 'bool Helpers.IsPlayerConnected(CCSPlayerController player)'.
{
return HookResult.Continue;
}
Expand Down Expand Up @@ -888,12 +888,12 @@

if (Helpers.IsValidPlayer(attacker))
{
_gameManager.AddScore(attacker, GameManager.ScoreForKill);

Check warning on line 891 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'player' in 'void GameManager.AddScore(CCSPlayerController player, int score)'.
}

if (Helpers.IsValidPlayer(assister))
{
_gameManager.AddScore(assister, GameManager.ScoreForAssist);

Check warning on line 896 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'player' in 'void GameManager.AddScore(CCSPlayerController player, int score)'.
}

return HookResult.Continue;
Expand All @@ -912,7 +912,7 @@

if (Helpers.IsValidPlayer(player))
{
_gameManager.AddScore(player, GameManager.ScoreForDefuse);

Check warning on line 915 in RetakesPlugin/RetakesPlugin.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'player' in 'void GameManager.AddScore(CCSPlayerController player, int score)'.
}

return HookResult.Continue;
Expand Down
Loading