I'm curious if anyone has used the GM:CheckPassword function and what it's behavior is?
its documented here [URL]http://wiki.garrysmod.com/page/GM/CheckPassword[/URL] but it doesn't really explain when it is called. From what they say it sounds like its always called, even if a password isn't set, but I'm wondering if anyone can confirm this or knows more about its behavior?
im wanting to use it for a ban system (I don't really want to have gatekeeper as a dependency) for my servers, but obviously I want to make sure there are no ways to bypass it and that it will behave as expected
yes, it is always called when a player joins your server regardless of if a password is set (sv_password)
it works very silimar to the gatekeepers PasswordAuth hook (or whatever it was called)
"return false" to reject their connection and kick them, "return false, 'my reason'" to reject their connection with a reason of "my reason", "return true" to allow them to join
if you plan on using bans for this, you will need to cache them on the server. if you use mysql to query the bans when they join, by the time the query has returned something the hook will have expired and returning either true or false will not do anything (found that out the hard way)
Yeah I realized that, thanks for the reply. Ill post the ban system I'm making using it later (or a simplified version)
The key is to cache all the bans into an array on server start, then run a simply check within the hook. Blam, return true/false "Your life has ended"
Thank you for a condescending comment explaining something I already know and have finished coding using a SQLite table synced with the MySQL database and caching for frequently accessed values...
So yeah... Blam...
Please don't assume that everyone who asks questions on here is completely stupid and needs the basics of Lua explained to them. I had hoped it was clear that I have an advanced knoladhe of Lua in the original question asked.
i also told him (just incase he didnt know) exactly what you just repeated - minus the condescension
Sorry, you need to Log In to post a reply to this thread.