CounterStrikeSharp icon indicating copy to clipboard operation
CounterStrikeSharp copied to clipboard

Targeting problem in commands

Open daffyyyy opened this issue 1 year ago • 0 comments

We can target by @ or nickname, we can also use #userid, #steamid64 and #STEAM. The problem is with targeting by steamid (both), only #userid works and #steamid64/#steam returns an error

Trying to find the target by

var matches = command.GetArgTargetResult(1);
15:22:32 [EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'id')
   at CounterStrikeSharp.API.Modules.Entities.SteamID..ctor(UInt64 id) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/Entities/SteamID.cs:line 13
   at CounterStrikeSharp.API.Modules.Entities.SteamID.op_Explicit(UInt64 u) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/Entities/SteamID.cs:line 19
   at CounterStrikeSharp.API.Modules.Commands.Targeting.Target.TargetPredicate(CCSPlayerController player, CCSPlayerController caller) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/Commands/Targeting/Target.cs:line 112
   at System.Linq.Enumerable.WhereListIterator`1.ToList()
   at CounterStrikeSharp.API.Modules.Commands.Targeting.Target.GetTarget(CCSPlayerController caller) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/Commands/Targeting/Target.cs:line 123

daffyyyy avatar Oct 06 '24 13:10 daffyyyy