Callback issue, "Index outside bounds of array"

Hey there,

Here’s my code server side :

RegisterServerEvent("me:IsFirstJoin")

AddEventHandler("me:IsFirstJoin", function(cb)
	local query = MySQL:executeQuery("SELECT sid FROM players WHERE sid = '@sid'", {['@sid'] = GetPlayerIdentifiers(source)[1]})
	if MySQL:getResults(query, {'sid'})[1] == nil then
		cb(false)
	else
		cb(true)
	end
end)

And here’s the code client side that replaces the simple “spawnPlayer()” in the spawnmanager.lua file :

TriggerServerEvent("me:IsFirstJoin", function(b)
	if b then
		spawnPlayer(--[[Correct values, just hidden for the topic]])
	else
		spawnPlayer()
	end
end)

Finally, here’s the error I have in the console :

Exception during queued callback: Index was outside the bounds of the array.

I tried using a simple event the same way that just prints something out in the console, it worked without any issue.

Any idea ?
Thanks

Edit : I tried adding some debug at the beginning of the callback, it doesn’t trigger

I’m pretty sure you can’t have a callback on the client called from the server (because the server-side code cannot see the client-side code). You can only trigger the other’s events.

As for your error, make sure the arrays you’re using have values. I.e

and