Targets: prefer an exact name, partial names for ungag/unmute/unsilence
Part of 1.8.2b-zio15.
This commit is contained in:
parent
dc5ad30952
commit
8bec658db4
4 changed files with 36 additions and 2 deletions
|
|
@ -242,7 +242,13 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||
if (matches.Count() == 1)
|
||||
return matches;
|
||||
|
||||
command.ReplyToCommand($"Multiple targets found for \"{command.GetArg(argument)}\".");
|
||||
// zio: a name that is exactly the pattern wins over names that only contain it, so "duck"
|
||||
// still finds "Duck" when "Ducky" is also on.
|
||||
var exact = matches.Players.Where(p => p.PlayerName.Equals(command.GetArg(argument), StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
if (exact.Count == 1)
|
||||
return new TargetResult { Players = exact };
|
||||
|
||||
command.ReplyToCommand($"Multiple targets found for \"{command.GetArg(argument)}\": {string.Join(", ", matches.Players.Select(p => p.PlayerName))}.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue