setstaticskill, next: target by part of a name, @me, #userid, ...
Same rules as setskill, but only when one player matches. Bump to 1.2.4.b3-panorama5.
This commit is contained in:
parent
75f4788236
commit
941d1f29af
2 changed files with 13 additions and 8 deletions
|
|
@ -228,6 +228,15 @@ namespace src.command
|
||||||
Reply("error_setskill");
|
Reply("error_setskill");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// zio: one player for commands that take a single target (css_setstaticskill, css_next): the
|
||||||
|
// css_setskill rules, so part of a name works, but only when it picks out one player.
|
||||||
|
private static CCSPlayerController? GetSinglePlayerTarget(CCSPlayerController? caller, string arg)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(arg)) return null;
|
||||||
|
var targets = GetSetSkillTargets(caller, arg, _ => true);
|
||||||
|
return targets.Count == 1 ? targets[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
// zio: css_setskill targets. An exact name or SteamID64 as before, CSS's own selectors
|
// zio: css_setskill targets. An exact name or SteamID64 as before, CSS's own selectors
|
||||||
// (@me, @all, @ct, @t, @alive, #userid, ...), or @random/@randomct/@randomt: one random
|
// (@me, @all, @ct, @t, @alive, #userid, ...), or @random/@randomct/@randomt: one random
|
||||||
// alive player, drawn only from players the skill's team restriction allows.
|
// alive player, drawn only from players the skill's team restriction allows.
|
||||||
|
|
@ -574,9 +583,7 @@ namespace src.command
|
||||||
{
|
{
|
||||||
Debug.WriteToDebug($"Player {player?.PlayerName} used the css_setstaticskill {command.ArgString} command.");
|
Debug.WriteToDebug($"Player {player?.PlayerName} used the css_setstaticskill {command.ArgString} command.");
|
||||||
if (!string.IsNullOrEmpty(config.NormalCommands.SetStaticSkillCommand.Permissions) && !AdminManager.PlayerHasPermissions(player, config.NormalCommands.SetStaticSkillCommand.Permissions)) return;
|
if (!string.IsNullOrEmpty(config.NormalCommands.SetStaticSkillCommand.Permissions) && !AdminManager.PlayerHasPermissions(player, config.NormalCommands.SetStaticSkillCommand.Permissions)) return;
|
||||||
var targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => p != null && p.IsValid
|
var targetPlayer = GetSinglePlayerTarget(player, command.GetArg(1));
|
||||||
&& (p.SteamID.ToString().Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase)
|
|
||||||
|| p.PlayerName.Equals(command.GetArg(1), StringComparison.OrdinalIgnoreCase)));
|
|
||||||
|
|
||||||
if (command.ArgCount < 2)
|
if (command.ArgCount < 2)
|
||||||
{
|
{
|
||||||
|
|
@ -723,10 +730,8 @@ namespace src.command
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(playerString))
|
if (!string.IsNullOrEmpty(playerString))
|
||||||
{
|
{
|
||||||
targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => p != null && p.IsValid
|
targetPlayer = GetSinglePlayerTarget(player, playerString);
|
||||||
&& (p.SteamID.ToString().Equals(playerString, StringComparison.CurrentCultureIgnoreCase)
|
|
||||||
|| p.PlayerName.Equals(playerString, StringComparison.OrdinalIgnoreCase)));
|
|
||||||
|
|
||||||
if (targetPlayer == null)
|
if (targetPlayer == null)
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace src
|
||||||
public override string ModuleName => "[CS2] [ jRandomSkills ]";
|
public override string ModuleName => "[CS2] [ jRandomSkills ]";
|
||||||
public override string ModuleAuthor => "D3X (Original), Juzlus (Modifier), ByDexterTR (Contributor)";
|
public override string ModuleAuthor => "D3X (Original), Juzlus (Modifier), ByDexterTR (Contributor)";
|
||||||
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
|
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
|
||||||
public override string ModuleVersion => "1.2.4.b3-panorama4";
|
public override string ModuleVersion => "1.2.4.b3-panorama5";
|
||||||
|
|
||||||
public override void Load(bool hotReload)
|
public override void Load(bool hotReload)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue