Skip to content

Commit 3b7a583

Browse files
Merge pull request #356 from shobhit-pathak/dev
0.8.15: noclip command fix
2 parents a196f57 + ef289d5 commit 3b7a583

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ConsoleCommands.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using CounterStrikeSharp.API.Core;
33
using CounterStrikeSharp.API.Core.Attributes.Registration;
44
using CounterStrikeSharp.API.Modules.Commands;
5+
using CounterStrikeSharp.API.Modules.Cvars;
56
using CounterStrikeSharp.API.Modules.Utils;
67
using System.Text.RegularExpressions;
78

@@ -714,12 +715,12 @@ public void OnVersionCommand(CCSPlayerController? player, CommandInfo? command)
714715
}
715716

716717
// Overrides noclip console command. Perform the changes on server side.
717-
public HookResult OnConsoleNoClip(CCSPlayerController? player, CommandInfo cmd) {
718+
public HookResult OnConsoleNoClip(CCSPlayerController? player, CommandInfo? cmd) {
718719
if (player == null || !player.PawnIsAlive || player.Team == CsTeam.Spectator || player.Team == CsTeam.None)
719720
return HookResult.Stop;
720-
if (cmd.CallingContext != CommandCallingContext.Console) {
721-
return HookResult.Stop; // abort when called in chat.
722-
// inefficient but CS# forces both...
721+
bool cheatsEnabled = ConVar.Find("sv_cheats")!.GetPrimitiveValue<bool>();
722+
if (!cheatsEnabled) {
723+
return HookResult.Stop;
723724
}
724725

725726
// inspired by cs2-noclip

0 commit comments

Comments
 (0)