Skip to content

Commit

Permalink
1.2.8c
Browse files Browse the repository at this point in the history
- Updated CounterStrikeSharp to 159
- Minor changes
  • Loading branch information
daffyyyy committed Jan 26, 2024
1 parent e584316 commit 67ad185
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions CS2-SimpleAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace CS2_SimpleAdmin;

[MinimumApiVersion(154)]
[MinimumApiVersion(159)]
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
{
public static IStringLocalizer? _localizer;
Expand All @@ -36,7 +36,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin";
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy";
public override string ModuleVersion => "1.2.8b";
public override string ModuleVersion => "1.2.8c";

public CS2_SimpleAdminConfig Config { get; set; } = new();

Expand Down Expand Up @@ -510,7 +510,7 @@ public void OnGagCommand(CCSPlayerController? caller, CommandInfo command)
if (TagsDetected)
NativeAPI.IssueServerCommand($"css_tag_mute {player!.UserId}");

if (player != null && player.UserId != null && gaggedPlayers.Contains((ushort)player.UserId))
if (player != null && player.UserId != null && !gaggedPlayers.Contains((ushort)player.UserId))
gaggedPlayers.Add((ushort)player.UserId);

if (time > 0 && time <= 30)
Expand Down Expand Up @@ -1689,10 +1689,9 @@ public void OnVoteCommand(CCSPlayerController? caller, CommandInfo command)
voteAnswers.Clear();
voteInProgress = false;
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);

return;
}

[ConsoleCommand("css_changemap")]
[ConsoleCommand("css_map")]
[RequiresPermissions("@css/changemap")]
[CommandHelper(minArgs: 1, usage: "<mapname>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
Expand All @@ -1706,19 +1705,20 @@ public void OnMapCommand(CCSPlayerController? caller, CommandInfo command)
return;
}

AddTimer(5f, () =>
{
Server.ExecuteCommand($"changelevel {map}");
});

if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map]);
Server.PrintToChatAll(sb.ToString());
}

AddTimer(3.0f, () =>
{
Server.ExecuteCommand($"changelevel {map}");
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
}

[ConsoleCommand("css_changewsmap", "Change workshop map.")]
[ConsoleCommand("css_wsmap", "Change workshop map.")]
[ConsoleCommand("css_workshop", "Change workshop map.")]
[CommandHelper(1, "<name or id>")]
Expand All @@ -1728,18 +1728,18 @@ public void OnWorkshopMapCommand(CCSPlayerController? caller, CommandInfo comman
string? _command = null;
var map = command.GetArg(1);

_command = ulong.TryParse(map, out var mapId) ? $"host_workshop_map {mapId}" : $"ds_workshop_changelevel {map}";
_command = int.TryParse(map, out var mapId) ? $"host_workshop_map {mapId}" : $"ds_workshop_changelevel {map}";
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map]);
Server.PrintToChatAll(sb.ToString());
}

AddTimer(5f, () =>
AddTimer(3.0f, () =>
{
Server.ExecuteCommand(_command);
});
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
}

[ConsoleCommand("css_asay", "Say to all admins.")]
Expand Down
2 changes: 1 addition & 1 deletion CS2-SimpleAdmin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.154" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.159" />
<PackageReference Include="Dapper" Version="*" />
<PackageReference Include="MySqlConnector" Version="2.3.5" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private void registerEvents()
RegisterEventHandler<EventRoundStart>(OnRoundStart);
AddCommandListener("say", OnCommandSay);
AddCommandListener("say_team", OnCommandTeamSay);
AddCommandListener("callvote", OnCommandCallVote);
//AddCommandListener("callvote", OnCommandCallVote);
}

/*private HookResult OnPlayerFullConnect(EventPlayerConnectFull @event, GameEventInfo info)
Expand Down Expand Up @@ -202,7 +202,7 @@ private void OnClientPutInServer(int playerSlot)

if (player != null && player.UserId != null && gaggedPlayers.Contains((ushort)player.UserId))
{
if (gaggedPlayers.TryTake(out ushort removedItem) && removedItem != (int)player.UserId)
if (gaggedPlayers.TryTake(out ushort removedItem) && removedItem != (ushort)player.UserId)
{
gaggedPlayers.Add(removedItem);
}
Expand Down

0 comments on commit 67ad185

Please sign in to comment.