Help with server whitelist

Hi FP,

I’m in the process of making a web-connected player whitelist for my server. Right now I have a PHP file that checks if the given Steam ID is allowed and returns a yes or no (basically). All I need is a good way to stop the player from joining if they aren’t on the whitelist. I’ve noticed a few hooks that are helpful but don’t really do the job.


This hook will provide the name and ip of the player as soon as they connect to the server. This would work if it passed a player entity that I could kick…


This would work fine since it passes a player entity, but the hook doesn’t get called until the player finishes loading. I would really prefer to just kick them right away (like a “Bad Password.” dialog).

So those are the options that are apparent to me. Does anyone else have some suggestions?

CheckPassword hook. It’s similar to the Gatekeeper module of GM12. It should work since you need SteamID and it includes SteamID

I did try that, but I don’t know how to make the hook function wait for the results of http.Fetch :confused:

I’d personally suggest a SQL database being what’s being called, because then you can query and return without needing a http.Fetch. (I use this method to check for banned players)

If you have to use http.Fetch I’d suggest PlayerAuthed, can’t think of another way to do it with that.

Being connected to a remote whitelist is an integral part of my idea ^^

I could use an SQL database but that would mean periodically polling a PHP script and fetching changes in the whitelist. I do appreciate your suggestions though, as that is yet another option.

I take it there’s no way to wait for the results of http request? **Edit: ** that would probably freeze the server wouldn’t it…

Never really dealt with http requests. But I’d assume so.

Why not have it entirely SQL and have the PHP query SQL as well?

Or another option would be to create a timer (like every 15 minutes, unless you plan on updating more often than that) that polls and pulls the changes and stores them in a table, then on CheckPassword do return table.HasValue(aTable,SteamID)

Hmmm… how would I query SQL with PHP?

When I say SQL I mean MySQL, not the SQLite library that is native in gmod. You’d need a module like mysqloo or tmysql4 on the server.


I wasn’t aware those modules even worked anymore. I’ll definitely give that a try.

Theres gmsv_mysqloo. Can’t find a thread for tmysql4, but it’s out there. The community I dev for uses it for our admin mods and integration systems

Sweet! Thanks =)