I got a custom event in my Lua script (server sided) and something is going wrong but I’m unsure what. The event looks something like this;
RegisterServerEvent ( "registerConnectedPlayer" ); AddEventHandler ( "registerConnectedPlayer", function ( accountId, department )
This has, as you can see, 2 parameters. but whenever I call it like so in the client, I get a mismatch in the count of parameters:
TriggerServerEvent("registerConnectedPlayer", -1, getElementData ( -1, "account.id" ), getElementData ( -1, "account.department" ) );
If I add in another parameter, it’ll crash everything and say;
Game\GameServer.cs(958): Error: GameServer::Tick: Exception during queued callback: Index was outside the bounds of the array.
Not sure where this is coming from, but it’s weird. Parameter count is correct, nor am I doing anything with a callback. I think it’s deeper than the code I’ve written. Any help is greatly appreciated!
Restarting the script after this error is also impossible, I’m forced to restart the entire server due to the error:
Commands\ResourceCommands.cs(151): Error: Resource::Restart_f: Error restarting resource.