How can I pass info from the server to client as early as the "PlayerConnecting" event?

Hi!
When a player connects to the server, I’m checking if he’s already existing in the DB with the “playerConnecting” event. After that, I want to send to the client some messages and informations (like it’s stats) so I can store them temporally on the client.

But with the playerConnecting, I’m too early to use the temporary source that is providen since the client seems not to be completely loaded at this point. How can I send informations to the client with this event?

I tought about using a client event and tell the server when it’s loaded, but I can’t find how to pass the source to tell the server which client is calling.

So if you could help me with that…

Thanks!

Don’t let clients pass their own source, that could mean they could pass someone else’s source. There’s a global variable called source in your callback which gets assigned the player source calling the event

So, if I understands correctly - which I’m not sure -, that means I can use “source” on the server-side when an event is triggered? Is that right or I’m talking about cows and goats? :sweat_smile:

Yes

from the docs:

In Lua/JS, the source variable (global) will contain the player ID that triggered the event. You should most likely save it in a local variable if you’re going to use it after the event returns.

1 Like

Oh my God. That works. I’ve read that page many times, but looks like I’ve always missed that information…
Thank you and have a good day dear person! :smiley: