Alright. I am making a script that I want to release. On my event, it requires 3 arguments, 1 being a
Player, and the other 2 being
String. When I try to trigger my event using a chat message, it sends the error to the chat, that goes something like
Error invoking callback for event ds:newname: System.InvalidCastException: Could not cast event argument from ExpandoObject to Player
at CitizenFX.Core.CallUtilities.<GetPassArguments>g__ChangeType0_0 (System.Object value, System.Type type) [0x00020] in /src/code/client/clrcore/EventHandlerDictionary.cs:121
at CitizenFX.Core.CallUtilities.GetPassArguments (System.Reflection.MethodInfo method, System.Object args, System.String sourceString) [0x00085] in /src/code/client/clrcore/EventHandlerDictionary.cs:159
at CitizenFX.Core.EventHandlerEntry+<Invoke>d__5.MoveNext () [0x00047] in /src/code/client/clrcore/EventHandlerDictionary.cs:84
CouldSending heartbeat to live-internal.fivem.net:30110
I don’t know why this is happening because there is nothing to cast, just the player to player in the event. I don’t know if this is happening to anyone else but this only happens to me when I do it to the class
Player. It never happens when I put
Boolean. I find this very weird and it is limiting my progress on my script. I have tried to fix it for many days now but it just doesn’t want to work.
EDIT: If you have this issue yourself, don’t look at just the answer, read the rest of the comments below. They will help you too if you are on server side.