Player joined for the first time hook?

hey i have tons of ideas for my darkrp server one of them was to make the players job visitor. but if they leave then join the server again some day. they will be citizen.

They could join and then leave and reconnect all within like 10 minutes :slight_smile:

But use SetPData() on the player, that saves over sessions

thanks. do u know how i would use it? the tut on the wiki not very useful


 player.GetByID( 1 ):SetPData( "money", 100 ) 

if they have not joined i set to this job. then if they have joined before set to the other job?

Store all players that have connected before in either a TXT file or SQL database. (PlayerInitialSpawn hook) Read the TXT/SQL and check if the player’s SteamID is in it. If not, run the code for one job. If so, run the code for another job etc.

[lua]hook.Add(“PlayerInitialSpawn”, “FirstJoin”, function(ply)

if !ply:GetPData("bool") then
	ply:SetPData("bool", true)
	print("first time joining!")
else
	print("ive joined before")
end

end)[/lua]

idk if this works

ok now i get it thanks!