Monthly Target: $400 Donations: $131
 32% 

[ANY] Simple Mysql Whitelist


Post New Thread Reply   
 
Thread Tools Display Modes
Author
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Plugin ID:
5331
Plugin Version:
1.4
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Mysql database whitelister to control player access to server[s].
    Old 08-28-2016 , 16:18   [ANY] Simple Mysql Whitelist
    Reply With Quote #1

    Simple Mysql Whitelist
    Mysql database whitelister to control player access to server[s].

    Currently Tested [CSS][CS:GO]


    Description:
    Spoiler


    Requirements:
    • A mysql database (obviously)

    Commands:
    • All commands including menu requires Admin-Root access.
    • sm_whitelist Opens the menu to list/remove
    • sm_whitelist_add Add a steamid to the database.
    • sm_whitelist_delete Deletes a steamid from the database.
    • sm_whitelist_list List all SteamIDs in the database.

    Cvars:
    • sm_whitelist_adminflag "0" Admin flag required [a -> z] [0 = OFF].

    Installation:
    Spoiler


    Notice This!:
    Spoiler


    Changelog:
    Code:
    1.0 - Plugin release
    1.1 - Added flags support and minor code edits.
    1.2 - Added bots to be allowed!
    1.3 - New method for faster player kick.
    1.4 - Threaded queries been updated for safer use.
    Attached Files
    File Type: sp Get Plugin or Get Source (simple_mysql_whitelister.sp - 49 views - 11.9 KB)
    __________________

    Last edited by xines; 09-03-2016 at 11:20. Reason: Adding stuff.
    xines is offline
    oaaron99
    AlliedModders Donor
    Join Date: Dec 2013
    Location: de_dust2
    Old 08-28-2016 , 17:02   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #2

    Nice plugin. Can confirm this works on CS:GO.
    __________________
    oaaron99 is offline
    blackhawk74
    SourceMod Moderator
    Join Date: Feb 2015
    Location: USA
    Old 08-28-2016 , 17:48   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #3

    Very nice!

    Feature request: Can you add flag support? For example, I would like everyone in the MySQL database to be able to connect to the server, but also users with the A flag.
    blackhawk74 is offline
    xines
    Veteran Member
    Join Date: Aug 2013
    Location: Denmark
    Old 08-28-2016 , 18:10   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #4

    Quote:
    Originally Posted by oaaron99 View Post
    Nice plugin. Can confirm this works on CS:GO.
    Thank you, good to know added to tested list!

    Quote:
    Originally Posted by blackhawk74 View Post
    Very nice!

    Feature request: Can you add flag support? For example, I would like everyone in the MySQL database to be able to connect to the server, but also users with the A flag.
    Thank you
    By default everyone is not allowed to get into the server, that's why you whitelist them in.

    Flags can be added, tho it will require me to take down function OnClientAuthorized and replace with OnClientPostAdminCheck, this will slow down the auto kick speed when not allowed into the server.
    Done
    __________________

    Last edited by xines; 08-29-2016 at 10:47.
    xines is offline
    oaaron99
    AlliedModders Donor
    Join Date: Dec 2013
    Location: de_dust2
    Old 08-28-2016 , 20:42   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #5

    Quote:
    Originally Posted by xines View Post
    Flags can be added, tho it will require me to take down function OnClientAuthorized and replace with OnClientPostAdminCheck, this will slow down the auto kick speed when not allowed into the server.
    Well you can make it so that if a flag is set then it will use OnClientPostAdminCheck and if not, use OnClientAuthorized
    __________________

    Last edited by oaaron99; 08-28-2016 at 20:43.
    oaaron99 is offline
    Potato Uno
    Veteran Member
    Join Date: Jan 2014
    Location: Atlanta, Georgia
    Old 08-28-2016 , 21:02   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #6

    IIRC doing it beyond OnClientAuthorized will kick the client AFTER they have downloaded the map, if any.

    If you want to kick them before they download the map, use OnClientAuthorized. There is also a way to get admin flags from a plain steam ID (forgot how).
    Potato Uno is offline
    xines
    Veteran Member
    Join Date: Aug 2013
    Location: Denmark
    Old 08-29-2016 , 10:05   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #7

    Quote:
    Originally Posted by oaaron99 View Post
    Well you can make it so that if a flag is set then it will use OnClientPostAdminCheck and if not, use OnClientAuthorized
    Yeah very possible with a global variable, but it's no big deal as the client never gets into the server before OnClientPostAdminCheck have been fired .

    Quote:
    Originally Posted by Potato Uno View Post
    IIRC doing it beyond OnClientAuthorized will kick the client AFTER they have downloaded the map, if any.

    If you want to kick them before they download the map, use OnClientAuthorized. There is also a way to get admin flags from a plain steam ID (forgot how).
    Yes sounds about right, however, the SteamID would require i think GetUserFlagBits function, and there's been more than enough information about why not to use this, so for now OnClientPostAdminCheck is the right option to choose.
    __________________
    xines is offline
    Potato Uno
    Veteran Member
    Join Date: Jan 2014
    Location: Atlanta, Georgia
    Old 08-31-2016 , 00:30   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #8

    I found the relevant code. Feel free to use it if you want:

    PHP Code:
    public void OnClientAuthorized(int iClient, const char[] SteamID)
    {
        
    AdminId Admin FindAdminByIdentity(AUTHMETHOD_STEAMSteamID);
        if (!
    GetAdminFlag(AdminAdmin_Custom1)) // change flag to whatever
            
    KickClient(iClient"reason here");

    Potato Uno is offline
    xines
    Veteran Member
    Join Date: Aug 2013
    Location: Denmark
    Old 08-31-2016 , 10:51   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #9

    Quote:
    Originally Posted by Potato Uno View Post
    I found the relevant code. Feel free to use it if you want:

    PHP Code:
    public void OnClientAuthorized(int iClient, const char[] SteamID)
    {
        
    AdminId Admin FindAdminByIdentity(AUTHMETHOD_STEAMSteamID);
        if (!
    GetAdminFlag(AdminAdmin_Custom1)) // change flag to whatever
            
    KickClient(iClient"reason here");

    Looks good, however, i'm unsure of this method due to asherkins answer here: https://forums.alliedmods.net/showthread.php?t=97165 I would need his opinion about this .
    __________________
    xines is offline
    Potato Uno
    Veteran Member
    Join Date: Jan 2014
    Location: Atlanta, Georgia
    Old 08-31-2016 , 11:14   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #10

    Asherkin uses it himself in his connect extension's plugin.

    You can still bolt a second check in postadmin to be super safe.

    I use that code to prevent non-admins from getting into a server and it never failed me.

    Last edited by Potato Uno; 08-31-2016 at 11:16.
    Potato Uno is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 14:51.


    Powered by vBulletin®
    Copyright ©2000 - 2017, vBulletin Solutions, Inc.
    Theme made by Freecode