Raised This Month: $32 Target: $400
 8% 

[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.5
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 , 15: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)

    Ingame Commands:
    • All Ingame 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.

    Server Commands:
    • sm_server_whitelist_add Add a steamid to the database. Useable by Rcon or Console
    • sm_server_whitelist_delete Deletes a steamid from the database. Useable by Rcon or Console

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

    Installation:
    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.
    1.5 - Added ServerCommands, Optimized mysql and fixed reported bugs.
    Attached Files
    File Type: sp Get Plugin or Get Source (simple_mysql_whitelister.sp - 1522 views - 21.9 KB)
    __________________

    Last edited by xines; 04-15-2017 at 20:43. Reason: Adding stuff.
    xines is offline
    Addicted.
    AlliedModders Donor
    Join Date: Dec 2013
    Location: 0xA9D0DC
    Old 08-28-2016 , 16:02   Re: [ANY] Simple Mysql Whitelist
    Reply With Quote #2

    Nice plugin. Can confirm this works on CS:GO.
    Addicted. is offline
    sneaK
    SourceMod Moderator
    Join Date: Feb 2015
    Location: USA
    Old 08-28-2016 , 16: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.
    sneaK is offline
    xines
    Veteran Member
    Join Date: Aug 2013
    Location: Denmark
    Old 08-28-2016 , 17: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 09:47.
    xines is offline
    Addicted.
    AlliedModders Donor
    Join Date: Dec 2013
    Location: 0xA9D0DC
    Old 08-28-2016 , 19: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 Addicted.; 08-28-2016 at 19:43.
    Addicted. is offline
    Potato Uno
    Veteran Member
    Join Date: Jan 2014
    Location: Atlanta, Georgia
    Old 08-28-2016 , 20: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 , 09: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-30-2016 , 23: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 , 09: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 , 10: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 10:16.
    Potato Uno is offline
    Reply



    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 04:42.


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