Check if someone has joined before...

So for my Garry’s Mod gamemode I want it to have a thing where if a player joins it will add their Steam ID to a text document. If their Steam ID is not already in the text document, I want it to open a DFrame or something. OR, you could just tell me how to check if someone has joined before! :v:

(Also, PlayerInitialSpawn activates when you connect, not the first time you join!)

I think the best option would be to store it in a database .db file on your server, for efficiency.

This may be a good place to start researching and learning

You could still use PlayerInitialSpawn, and check if they are already in the database or not, if not add them.

Alright thanks! I’ll try that doing that.

Yup basically. you need to create an SQLite database that, upon a player joins, will query the query the database for that players unique ID. If it doesn’t exist, they haven’t joined before. So add them to the database, and make your popup on their screen or whatever you’d like to do.

Some tips:

I would recommend storing by UniqueID, gotten with ply:UniqueID(). The reason for this is because steamID’s are longer, and need to be stored as strings. unique IDs can just be stored as integers. Another side effect is that they are more secure. A uniqueID can’t be turned back into a steamID unless the player is in the server. If you database were to become compromised, the theives wouldn’t be able to tell who each uniqueID corresponds too. In this case that’s not really a concern, but is something to take into account.

No. Why would you over-complicate things?

[lua]local cv = CreateClientConVar(“iwashere”, “0”, true, false)
hook.Add(“Initialize”, “Hi”, function()
if not cv:GetBool() then
RunConsoleCommand(“iwashere”, “1”)

    -- Make a DFrame, do something. Whatever.
end

end)[/lua]

I would use Player:SteamID64() and store it in an integer. Both because I don’t plan on someone dumping my DB and if they did it would be as useful as dumping a DB full of nicknames anyway. Plus if someone ever needs to be banned I would have a neat listing of ID’s.