View Single Post
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 12-17-2018 , 23:18   Re: [Any] Force Auth
Reply With Quote #4

Quote:
Originally Posted by JoinedSenses View Post
Edited: OnClientPostAdminCheck is only called if a client is authorized? If so your advice is for general use within plugins, which is useful for developers. If I were to move my check there, it would do nothing during connect if the client has not authorized, correct?
Correct.

A previous version of the [ANY] Store by Zephyrus was loading inventories doing it's things OnClientAuthorized.

Connecting while the Steam network was down, and then getting authorized later on, and quitting the server would usually lead to credit loss in this Store.

Moving checks to OnClientPostAdminCheck, where the checks requiring Steam ID / "authentication" status are today, solved all those issues.

Quote:
Originally Posted by JoinedSenses View Post
For example, by moving checks to OnClientPostAdminCheck and a banned client isn't authorized, they'll be able to join the server until they are authorized. If that is the case, then this plugin will prevent that from occuring.
Correct, and you don't really want to do anything before, as you do not yet know that the Steam ID is indeed the "correct one" you want to act on.

It makes no sense for my server to claim you are banned, if you are not, does it?

Quote:
Originally Posted by JoinedSenses View Post
This plugin is meant as a hotfix for server owners who may not know much about plugin development and server events.
It is very great that you care about others, like I feel you do with your attempt here. Thumbs up (and ) for that.

However, it is not your "job" to make a hotfix for other potentially "lousy" developers. It is the developer's project to fix his/her plugins (or the new person who have taken over the development, if relevant), not you.

So if you find any plugins that are doing checks in an improper way, where you feel like a plugin like this is necessary, I suggest you report those plugins for review, so any bad plugins out there can be unapproved.

Quote:
Originally Posted by JoinedSenses View Post
The entire purpose is to force authentication as the title says, so I'm not certain why this has been unapproved.
Quote:
Originally Posted by Powerlord View Post
SourceMod fires connect and admin events for every player on every map change.

OnClientConnect
OnClientConnected
OnClientAuthorized*
OnClientPreAdminCheck
OnClientPostAdminFilter
OnClientPostAdminCheck
OnClientPutInServer*

* These can occur in any order. Because of this, you should never do admin/STEAM ID checks in OnClientPutInServer.
^

The stars and the description tells it all, you are exactly doing what that post tells you not to do.

Your plugin uses the two functions that may be called in a random order, for your connect it may work because the events are fired in the order you expect, however for my connect it may not - because of the "in any order".

A default SourceMod configuration will only call OnClientPostAdminCheck after the autorization is approved and the Steam ID is 100% valid etc., so I would suggest setting g_bAuthorized to true in that one instead.

At a regular frequency, e.g. after a (or every) minute or so, scan all players and if (!IsClientAuthorized(client)), then act on it, if g_bAuthorized hasn't yet been set to true.

To print the connection message to all if set, I wouldn't care if you are triggering it in both OnClientAuthorized and OnClientPutInServer though. To avoid duplicates, you could make a new bool to see if it has already been printed.


Based on my experience (as well as, ... "some" others), there is like a 9/10 chance that all your players are eventually being reconnected over and over, with your current way of doing it, since you are acting in a place where you know you aren't guaranteed to have the information you need.

I don't suppose you want to introduce even more issues for server owners, with your "hotfix", am I right?

That's the major point for my action with the unapproval.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].

Last edited by DarkDeviL; 12-17-2018 at 23:22.
DarkDeviL is offline