Saladier Posted February 13, 2022 Posted February 13, 2022 Hello, I tried to use the NAPI.LocalEvent.Register and NAPI.LocalEvent.TriggerEvent to call some server scripts from other scripts. This code works fine and is called on a Event.ResourceStart tagged method: var methodInfo2 = _manager.GetType().GetMethod("EventHandler"); if (methodInfo2 != null) { NAPI.LocalEvent.Register(methodInfo2, "TestEvent2", _manager); } _manager is an attribute of the class where I run this code and is instanciated. [Command("testevent2")] public void TestEventCommand(Player player) { NAPI.LocalEvent.TriggerEvent("TestEvent2", 1); } I have a NullReferenceException when I run this code. This exception is thrown from Bootstrapper.dll. _manager is still instanciated at this point and is accessible. According to debug tools, it seems that a delegate on the RAGE API is null. Is it a known bug? Am I using correctly this API? Best regards
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now