Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RecipientFilter.cs #659

Closed
wants to merge 1 commit into from
Closed

Update RecipientFilter.cs #659

wants to merge 1 commit into from

Conversation

oqyh
Copy link
Contributor

@oqyh oqyh commented Nov 5, 2024

System.ArgumentException: Player with slot 4 not found

HookUserMessage(208, um =>
{
var soundevent = um.ReadUInt("soundevent_hash");
return HookResult.Continue;
}, HookMode.Pre);

    changing teams will lead the error
    
    Error invoking callback

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentException: Player with slot 4 not found
at CounterStrikeSharp.API.Modules.Utils.RecipientFilter..ctor(UInt64 mask) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/Utils/RecipientFilter.cs:line 57
at CounterStrikeSharp.API.Modules.UserMessages.UserMessage..ctor(IntPtr pointer) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Modules/UserMessages/UserMessage.cs:line 14
at InvokeStub_UserMessage..ctor(Object, Span1) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) --- End of inner exception stack trace --- at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at CounterStrikeSharp.API.Core.ScriptContext.GetResult(Type type, Byte* ptr) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/ScriptContext.cs:line 426 at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass18_0.<CreateWrappedCallback>b__1(ParameterInfo _, Int32 i) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 96 at System.Linq.Enumerable.SelectIterator[TSource,TResult](IEnumerable1 source, Func3 selector)+MoveNext() at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable`1 items)
at CounterStrikeSharp.API.Core.FunctionReference.b__18_0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 94

https://discord.com/channels/1160907911501991946/1160925208203493468/1302399920413736992

@oqyh oqyh marked this pull request as ready for review November 5, 2024 15:04
@oqyh oqyh requested a review from roflmuffin as a code owner November 5, 2024 15:04
@KillStr3aK
Copy link
Contributor

Well, this might make sense but plugin devs should be aware of this and not passing an invalid player in the first place

@oqyh oqyh closed this Nov 7, 2024
@Prefix
Copy link

Prefix commented Nov 7, 2024

Well, this might make sense but plugin devs should be aware of this and not passing an invalid player in the first place

well this is quoted from my issue...
So in this specific case I should always loop recipient list, remove all non-existant and always return return HookResult.Handled ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants