You have an error in your code for processing the blind command with 2 arguments. On line 162, after you've populated your PlayerList array, you check to make sure a player is found, but your check evaluates true only when a player is not found.
This:
if (targetplayer != null)
Should be this:
if (targetplayer == null)
The two argument command kept telling me there was no player online when I knew there was, and I made this change and it worked as expected.
On a related note, if the player actually does not exist, your code is throwing an unhandled exception rather than giving the message you intend. This is what I see in RCON:
Otherwise, fantastic plugin. I'm using it as part of a suite of progressively more harsh punishments for trolls, griefers and rule breakers.
This:
if (targetplayer != null)
Should be this:
if (targetplayer == null)
The two argument command kept telling me there was no player online when I knew there was, and I made this change and it worked as expected.
On a related note, if the player actually does not exist, your code is throwing an unhandled exception rather than giving the message you intend. This is what I see in RCON:
Failed to call hook 'BlindCMD' on plugin 'PlayerBlinder v1.0.5' (ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index)
at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in :0
at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in :0
at Oxide.Plugins.PlayerBlinder.BlindCMD (Oxide.Core.Libraries.Covalence.IPlayer player, System.String command, System.String[] args) [0x0038d] in <776462064e8243f09dce3264055fcb87>:0
at Oxide.Plugins.PlayerBlinder.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0024b] in <776462064e8243f09dce3264055fcb87>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0
You might need to put the player not found check before the multiple players check and make sure that the PlayerList array itself is not null or has elements or something along those lines. If I get some time I'll run some tests and figure out what it needs.Otherwise, fantastic plugin. I'm using it as part of a suite of progressively more harsh punishments for trolls, griefers and rule breakers.