Skip to content

Commit

Permalink
Fix workshop map issues (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
abnerfs authored Jan 14, 2024
1 parent 2980535 commit 07baa40
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions RockTheVote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using System.ComponentModel.Design;
using static CounterStrikeSharp.API.Core.Listeners;

namespace cs2_rockthevote
{
public class RockTheVote : BasePlugin, IPluginConfig<Config>
{
public override string ModuleName => "RockTheVote";
public override string ModuleVersion => "0.0.2";
public override string ModuleVersion => "0.0.3";
public override string ModuleAuthor => "abnerfs";
public override string ModuleDescription => "You know what it is, rtv";

Expand Down Expand Up @@ -46,7 +45,6 @@ void LoadMaps()
.Split("\n")
.Select(x => x.Trim())
.Where(x => !x.StartsWith("//"))
.Where(x => Server.IsMapValid(x))
.ToList();
}

Expand Down Expand Up @@ -104,7 +102,7 @@ void NominateHandler(CCSPlayerController? player, string map)
{
player!.PrintToChat($"[RockTheVote] Usage: nominate <map-name>");
}
else if (Server.IsMapValid(map))
else if (Maps.FirstOrDefault(x => x.ToLower() == map) is not null)
{
if (map == Server.MapName)
{
Expand All @@ -127,7 +125,7 @@ public void OnNominate(CCSPlayerController? player, CommandInfo command)
if (!ValidateCommand(player))
return;

string map = command.GetArg(1);
string map = command.GetArg(1).Trim().ToLower();
NominateHandler(player, map);
}

Expand Down
2 changes: 1 addition & 1 deletion ServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ namespace cs2_rockthevote
{
public class ServerManager
{
public int ValidPlayerCount { get => Utilities.GetPlayers().Where(x => x.IsValid && !x.IsBot).Count(); }
public int ValidPlayerCount { get => Utilities.GetPlayers().Where(x => x.IsValid && !x.IsBot && !x.IsHLTV).Count(); }
}
}
1 change: 1 addition & 0 deletions VoteManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void EndVote()

Plugin.AddTimer(4.0F, () =>
{
Server.ExecuteCommand($"ds_workshop_changelevel {winner.Key}");
Server.ExecuteCommand($"changelevel {winner.Key}");
});
}
Expand Down

0 comments on commit 07baa40

Please sign in to comment.