[RESOLVED] Function playerConnected or something?

Hi, I would like to send a notif to players when they are connected. But I can’t find a function for this.
I know there is playerSpawned, but I don’t want my message appears every time they are die.

Can someone tell me if a connect function exist please? Thank you !

Hi, you tried this :

AddEventHandler(‘playerConnecting’, function()
– CODE HERE
end)

Hi, yes, it’s the first thing I tried, but It does nothing

Can we see a bit of your code?

Sure, it’s just a simple script:

AddEventHandler(‘playerSpawned’, function(spawn)
Citizen.CreateThread(function()
while true do
Wait(0)
local name = GetPlayerName(source.id)

	SetNotificationTextEntry("STRING");
	AddTextComponentString("Rendez-vous sur ~y~www.lenouveaumonderp.fr ~w~pour suivre l'avancer du serveur.")
	SetNotificationMessage("CHAR_ALL_PLAYERS_CONF", "CHAR_ALL_PLAYERS_CONF", true, 1, "Bienvenue", name)
	DrawNotification(false, true);
	Wait(100000000)
end

end)
end)

Try it, I can not try now but it should work :

message_welcome = true

AddEventHandler('playerSpawned', function(spawn)
	Citizen.CreateThread(function()
		while true do
			Wait(0)
			local name = GetPlayerName(source.id)
			
			if (message_welcome) then
				SetNotificationTextEntry("STRING");
				AddTextComponentString("Rendez-vous sur ~y~www.lenouveaumonderp.fr ~w~pour suivre l'avancer du serveur.")
				SetNotificationMessage("CHAR_ALL_PLAYERS_CONF", "CHAR_ALL_PLAYERS_CONF", true, 1, "Bienvenue", name)
				DrawNotification(false, true);
				message_welcome = false
			end
		end
	end)
end)

Yes it’s working, thanks a lot !

No problem, think about editing your subject in resolve