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

[Bug] Stacktrace if user gets kicked, before the timer ends #9

Open
danir-de opened this issue Apr 26, 2024 · 5 comments
Open

[Bug] Stacktrace if user gets kicked, before the timer ends #9

danir-de opened this issue Apr 26, 2024 · 5 comments

Comments

@danir-de
Copy link

If the timer is set ("Timer": 5,) and the user gets kicked or disconnects before the welcome message is sent, the plugin sends a stacktrace to the log:

[#979216412 UDP steamid:[email protected]:49685 'userName'] closed by app, linger requested but not needed (2039) NETWORK_DISCONNECT_KICKED
Removing Steam Net Connection for 123.123.123.123:49685, handle #979216412
19:51:08 [EROR] (cssharp:Core) Error invoking callback
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Entity is not valid
   at CounterStrikeSharp.API.Guard.IsValidEntity(CEntityInstance ent) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Guard.cs:line 8
   at CounterStrikeSharp.API.Core.CCSPlayerController.PrintToChat(String message) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Model/CCSPlayerController.cs:line 51
   at Main.Main.<>c__DisplayClass12_0.<OnPlayerConnectFull>b__0() in D:\cs2server\steamapps\common\Counter-Strike Global Offensive\game\csgo\addons\counterstrikesharp\source\Welcome\Main.cs:line 82
   at InvokeStub_Action.Invoke(Object, Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<CreateWrappedCallback>b__18_0(fxScriptContext* context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 100

This seems to come from the plugin trying to fetch user data once the timer ends, but by then he has already disconnected, leading to this error.

@Klayeryt
Copy link
Owner

Can you post the config?

@danir-de
Copy link
Author

The config looks like this:

// This configuration was automatically generated by CounterStrikeSharp for plugin 'Welcome', at 2024.03.09 05:25:53
{
  "PluginName": "[CHRONICALSde][Welcome] | ",
  "Timer": 5,
  "WelcomePlayerOneEnable": "true",
  "WelcomePlayerAllEnable": "true",
  "DisconnectPlayerAllEnable": "true",
  "WelcomeText": "\u0001[\u000bCHRONICALS\u0008de\u0001] \u0008============== \u000bWILLKOMMEN \u0008============== {ENTER}\u0001[\u000bCHRONICALS\u0008de\u0001] Willkommen bei \u000bCHRONICALS\u0008de\u0001, \u000b{PLAYERNAME}\u0001! {ENTER} \u0001[\u000bCHRONICALS\u0008de\u0001] Mode: \u000bRetakes\u0001 - Map: \u000b{MAP}\u0001 - Online: \u000b{PLAYERS}\u0001/\u000b{MAXPLAYERS}\u0001{ENTER} \u0001[\u000bCHRONICALS\u0008de\u0001] TeamSpeak, CS2 Server & mehr: \u0009CHRONICALS.de{ENTER} \u0001[\u000bCHRONICALS\u0008de\u0001] \u0008=========== \u0001Good Luck, Have fun! \u0008=========== {ENTER} {ENTER}",
  "disconnectAllText": " \u0001[{RED}-\u0001] {PLAYERNAME} ({REASON}) ",
  "WelcomeAllText": " \u0001[{GREEN}+\u0001] {PLAYERNAME} ",
  "ConfigVersion": 1
}

@Klayeryt
Copy link
Owner

"WelcomeText": " ...(example text) "

@danir-de
Copy link
Author

What do you mean? "WelcomeText": ... included in my snippet :)

The error occurs if the user gets kicked (by Whitelist, another plugin, etc.) or leaves while joining.

@Klayeryt
Copy link
Owner

Klayeryt commented Aug 25, 2024

{
"PluginName": "[CHRONICALSde][Welcome] | ",
"Timer": 5,
"WelcomePlayerOneEnable": "true",
"WelcomePlayerAllEnable": "true",
"DisconnectPlayerAllEnable": "true",
"WelcomeText": " \u0001[\u000bCHRONICALS\u0008de\u0001] \u0008============== \u000bWILLKOMMEN \u0008============== {ENTER}\u0001[\u000bCHRONICALS\u0008de\u0001] Willkommen bei \u000bCHRONICALS\u0008de\u0001, \u000b{PLAYERNAME}\u0001! {ENTER} \u0001[\u000bCHRONICALS\u0008de\u0001] Mode: \u000bRetakes\u0001 - Map: \u000b{MAP}\u0001 - Online: \u000b{PLAYERS}\u0001/\u000b{MAXPLAYERS}\u0001{ENTER} \u0001[\u000bCHRONICALS\u0008de\u0001] TeamSpeak, CS2 Server & mehr: \u0009CHRONICALS.de{ENTER} \u0001[\u000bCHRONICALS\u0008de\u0001] \u0008=========== \u0001Good Luck, Have fun! \u0008=========== {ENTER} {ENTER} ",
"disconnectAllText": " \u0001[{RED}-\u0001] {PLAYERNAME} ({REASON}) ",
"WelcomeAllText": " \u0001[{GREEN}+\u0001] {PLAYERNAME} ",
"ConfigVersion": 1
}

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

No branches or pull requests

2 participants