This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Admin for all who Connect - Experiment


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
darkfoon
Junior Member
Join Date: May 2011
Old 08-19-2011 , 01:56   Admin for all who Connect - Experiment
Reply With Quote #1

So, I am trying an experiment, where everybody who connects to my server has a basic level of admin access (mostly the fun commands). However, I can't see how to get this to work without somehow automatically adding the SteamID of every person who joins the server to admins.cfg (adding them to the group with the proper restrictions) and reloading all admins. Is there a way I can set command access ( in admin_overrides.cfg I presume) for unauthenticated players without having to alter plugin code?
darkfoon is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-19-2011 , 04:21   Re: Admin for all who Connect - Experiment
Reply With Quote #2

admin_overrides.cfg
Code:
Overrides
{
    /**
     * By default, commands are registered with three pieces of information:
     * 1)Command Name         (for example, "csdm_enable")
     * 2)Command Group Name    (for example, "CSDM")
     * 3)Command Level        (for example, "changemap")
     *
     * You can override the default flags assigned to individual commands or command groups in this way.
     * To override a group, use the "@" character before the name.  Example:
     * Examples:
     *        "@CSDM"            "b"                // Override the CSDM group to 'b' flag
     *         "csdm_enable"    "bgi"            // Override the csdm_enable command to 'bgi' flags
     *
     * Note that for overrides, order is important.  In the above example, csdm_enable overwrites
     * any setting that csdm_enable previously had.
     *
     * You can make a command completely public by using an empty flag string.
     */
    "sm_burn"        ""
    "sm_beacon"        ""
    "sm_admin"        "" //Open admin menu
}
This way you make admin commands to public (RegAdminCmd)
Anyone can start use that command from admin menu, own console sm_command or via chat trigger !command or /command

But there is problem use commands what have to target other players if they have not listed in admins (admins.cfg or admin_simple.ini)
Bug 5025 - cannot target other players with overriden commands.
Depends plugin are they using different way list target instead ProcessTargetString


Another way is create new category in Admin Menu, where players can execute commands. But these commands are executed from server input.
They can't execute anymore from own console or using chat trigger !command /command
From chat, admin activities you see "[SM] Console: toggled beacon on Bacardi."
In logs
Code:
L 08/19/2011 - 10:58:05: [funcommands.smx] "Console<0><Console><Console>" set a beacon on "Bacardi<4><STEAM_0:1:14163588><>"
So you don't know who executed that command...
adminmenu_custom.txt
Code:
// Custom admin menu commands.
// For more information:
//
// http://wiki.alliedmods.net/Custom_Admin_Menu_%28SourceMod%29
//
// Note: This file must be in Valve KeyValues format (no multiline comments)
//

"Commands"
{
    "Public Commands"
    {
        "Beacon"
        {
            "cmd"        "sm_beacon #1"
            "admin"        "sm_admin"
            "execute"    "server"
            "1"
            {
                "title"        "Beacon"
                "type"        "player"
            }
        }

        "Burn 2 seconds"
        {
            "cmd"        "sm_burn #1 2.0"
            "admin"        "sm_admin"
            "execute"    "server"
            "1"
            {
                "title"        "Burn 2 seconds"
                "type"        "player"
            }
        }
    }
}
admin_overrides.cfg
Code:
Overrides
{
    /**
     * By default, commands are registered with three pieces of information:
     * 1)Command Name         (for example, "csdm_enable")
     * 2)Command Group Name    (for example, "CSDM")
     * 3)Command Level        (for example, "changemap")
     *
     * You can override the default flags assigned to individual commands or command groups in this way.
     * To override a group, use the "@" character before the name.  Example:
     * Examples:
     *        "@CSDM"            "b"                // Override the CSDM group to 'b' flag
     *         "csdm_enable"    "bgi"            // Override the csdm_enable command to 'bgi' flags
     *
     * Note that for overrides, order is important.  In the above example, csdm_enable overwrites
     * any setting that csdm_enable previously had.
     *
     * You can make a command completely public by using an empty flag string.
     */
    "sm_admin"        ""
}
suit yourself


*edit
hmm.. there maybe can do plugin what add example immunitylevel to connected player, this way we get first admin_overrides.cfg example works.
Need check if have already or it make too much in
sm_dump_admcache
I try look about it
__________________
Do not Private Message @me

Last edited by Bacardi; 08-19-2011 at 06:51.
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-19-2011 , 05:38   Re: Admin for all who Connect - Experiment
Reply With Quote #3

Sry douple post. (what the hell I have written lot of )

Be carefull, I test first
http://www.sourcemod.net/compiler.php
PHP Code:
public Plugin:myinfo = {
    
name "Add non-admins to admins",
    
author "Bacardi",
    
description "Automatically add non-admins to admins cache",
    
version "0.1",
    
url "-"
};

public 
OnClientPostAdminCheck(client)
{
    if(!
IsFakeClient(client) && GetUserAdmin(client) == INVALID_ADMIN_ID)
    {
        new 
AdminId:admin CreateAdmin();
        
SetUserAdmin(clientadmintrue);
    }

*edit
Ok, this plugin help little bit non-admins use public admin commands.
  • This not add public players in admin list (admins.cfg or admins_simple.ini) when they connect server
  • They not get adminflags or immunity
  • Not affect players who already have admin rights
  • Not affect bots
But those are automatically added in admins cache list (or what called)
You see it using server command
rcon sm_dump_admcache
This create file ...addons\sourcemod\data\admin_cache_dump.txt
Code:
"Groups"
{
    /* num = 1, gid = 0x0 */
    "Default"
    {
        "flags"            ""
        "immunity"        "1"

        "Overrides"
        {
        }
    }

    /* num = 2, gid = 0x2C */
    "Full Admins"
    {
        "flags"            "abcdefghijklmnz"
        "immunity"        "99"

        "Overrides"
        {
        }
    }
}

"Admins"
{
    /* num = 1, aid = 0x5C, serialno = 0x1*/
    "BAILOPAN"
    {
        "auth"            "steam"
        "identity"        "1:16"
        "flags"            "abcdef"
        "immunity"        "0"
    }

    /* num = 2, aid = 0xAA, serialno = 0x1*/
    ""
    {
        "flags"            ""
        "immunity"        "0"
    }
}

"Overrides"
{
    "sm_admin"        ""
    "sm_beacon"        ""
    "sm_burn"        ""
}
If you see, these are temporary admins.
When they disconnect, it remove automatically from admin cache list.

Then do normally admin_overrides.cfg and do nothing in adminmenu_custom.txt
Code:
Overrides
{
    /**
     * By default, commands are registered with three pieces of information:
     * 1)Command Name         (for example, "csdm_enable")
     * 2)Command Group Name    (for example, "CSDM")
     * 3)Command Level        (for example, "changemap")
     *
     * You can override the default flags assigned to individual commands or command groups in this way.
     * To override a group, use the "@" character before the name.  Example:
     * Examples:
     *        "@CSDM"            "b"                // Override the CSDM group to 'b' flag
     *         "csdm_enable"    "bgi"            // Override the csdm_enable command to 'bgi' flags
     *
     * Note that for overrides, order is important.  In the above example, csdm_enable overwrites
     * any setting that csdm_enable previously had.
     *
     * You can make a command completely public by using an empty flag string.
     */
     "sm_admin"        ""
     "sm_burn"        ""
     "sm_beacon"        ""
}

Last edited by Bacardi; 08-19-2011 at 06:47.
Bacardi is offline
darkfoon
Junior Member
Join Date: May 2011
Old 08-20-2011 , 03:55   Re: Admin for all who Connect - Experiment
Reply With Quote #4

Thank your very much, Bacardi! Your plugin works very well, and so far, I can target bots all I want. If you make any more developments on it, please PM me or let me know some how. I would very much like to continue to use it.
darkfoon is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-20-2011 , 05:11   Re: Admin for all who Connect - Experiment
Reply With Quote #5

Quote:
Originally Posted by darkfoon View Post
Thank your very much, Bacardi! Your plugin works very well, and so far, I can target bots all I want. If you make any more developments on it, please PM me or let me know some how. I would very much like to continue to use it.
Ok, but I need to know, do this have bad side effect...
Personally I don't like give to just anybody "admin privilege" even they not get any Immunity, admin flags or admin command overrides (expect commands overrided to public).

But this help targeting other player though

I would still mention to everyone that be careful using this plugin.
Bacardi is offline
darkfoon
Junior Member
Join Date: May 2011
Old 08-20-2011 , 07:54   Re: Admin for all who Connect - Experiment
Reply With Quote #6

Bacardi, if you don't mind, I would like to see if I can add to this plugin and maybe make it so there's a list of commands it allows people to use. I am keeping an eye on people using it to make sure they aren't doing anything they shouldn't be.
darkfoon is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-20-2011 , 10:36   Re: Admin for all who Connect - Experiment
Reply With Quote #7

Quote:
Originally Posted by darkfoon View Post
Bacardi, if you don't mind, I would like to see if I can add to this plugin and maybe make it so there's a list of commands it allows people to use. I am keeping an eye on people using it to make sure they aren't doing anything they shouldn't be.
yes, you can.
You could make it work so it adds public players in one of admin_groups.cfg, where have override command "allow".
If not want to override commands to public from admin_overrides.cfg

*edit
Like this way
PHP Code:
public Plugin:myinfo = {
    
name "Add non-admins to admin group public",
    
author "Bacardi",
    
description "Automatically add non-admins to admin group public",
    
version "0.1",
    
url "-"
};

public 
OnClientPostAdminCheck(client)
{
    if(!
IsFakeClient(client) && GetUserAdmin(client) == INVALID_ADMIN_ID)
    {
        new 
GroupId:id FindAdmGroup("public"); // Need create admin group called "public" in admin_groups.cfg

        
if(id == INVALID_GROUP_ID)
        {
            
// Didn't find admin group "public" from admin_groups.cfg
            
return;
        }

        new 
AdminId:admin CreateAdmin();
        
SetUserAdmin(clientadmintrue);
        
AdminInheritGroup(adminid);
    }

If admin group called "public" exist (admin_groups.cfg), will automatically add public players in that group.

And in admin_groups.cfg you can give admin commands/admin immunities to use.
Not need use admin_overrides.cfg anymore.
Code:
Groups
{
    /**
     * Allowed properties for a group:
     *
     *   "flags"           - Flag string.
     *   "immunity"        - Immunity level number, or a group name.
     *                         If the group name is a number, prepend it with an 
     *                         '@' symbol similar to admins_simple.ini.  Users 
     *                         will only inherit the level number if it's higher 
     *                         than their current value.
     */
    "public"
    {
        Overrides
        {
            "sm_admin"        "allow"
            "sm_burn"        "allow"
            "sm_beacon"        "allow"
        }
        // Please, don't give any admin flags, okay ?
         "immunity"        "0"
    }
    
    "Full Admins"
    {
        /**
         * You can override commands and command groups here.
         * Specify a command name or group and either "allow" or "deny"
         * Examples:
         *         ":CSDM"            "allow"
         *        "csdm_enable"    "deny"
         */
         Overrides
         {
         }
        "flags"            "abcdefghijklmnz"

        /* Largish number for lots of in-between values. */
        "immunity"        "99"
    }
}
__________________
Do not Private Message @me

Last edited by Bacardi; 08-20-2011 at 11:07.
Bacardi is offline
darkfoon
Junior Member
Join Date: May 2011
Old 08-21-2011 , 01:03   Re: Admin for all who Connect - Experiment
Reply With Quote #8

Thank you Bacardi for that start! It doesn't work at the moment, but I will read up on the admin programming, and I will try to fix it. Thank you again! edit: nevermind, it works just fine. I forgot to upload the new plugin.

Last edited by darkfoon; 08-21-2011 at 01:15. Reason: spoke too soon
darkfoon is offline
Mr. Man
Veteran Member
Join Date: Mar 2011
Location: Huh?
Old 10-14-2012 , 20:37   Re: Admin for all who Connect - Experiment
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
Sry douple post. (what the hell I have written lot of )
Just looked through this solution for vote kicking and it works nicely without compromising basic admin features.

To be clear about this solution, it allows public players to execute all commands defined in the admin_override.cfg file that doesn't have a set flag.

Last edited by Mr. Man; 10-14-2012 at 20:38.
Mr. Man 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 23:59.


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