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

Maximum ban time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cerobug
Member
Join Date: Jun 2008
Old 04-09-2012 , 21:37   Maximum ban time
Reply With Quote #1

I was wondering if it is possible to limit how long an admin group could ban for. We want to setup a custom admin group through sourcebans that would allow us to restrict that group of admins to only be able to ban for a maximum of 1 hour at a time. Is this possible and if so how would I go about doing it?

We also want this to only effect that admin group and not the other groups that we have setup.

Last edited by Cerobug; 04-09-2012 at 21:38.
Cerobug is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 04-09-2012 , 21:45   Re: Maximum ban time
Reply With Quote #2

I actually wanted to do this myself, and I am pretty sure it's possible to make as a separate plugin, but it's not currently built-in into Sourcemod.
P.S: On a side note, I wanted to do this about a month ago but turned out giving up on it, and just gave my admins perma banning ability.
minimoney1 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-09-2012 , 22:50   Re: Maximum ban time
Reply With Quote #3

just alter basebans and make a new plugin from it, customizing it to only be max 60 minutes for a certain group...
__________________
View my Plugins | Donate
TnTSCS is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 04-09-2012 , 22:53   Re: Maximum ban time
Reply With Quote #4

I'll write up a quick plugin tomorrow using AddCommandListener to impliement this functionality without requiring a modified basechat/sourcebans. I'd do it tonight but i'll be losing power any minute now from these pesky storms .
__________________
thetwistedpanda is offline
Cerobug
Member
Join Date: Jun 2008
Old 04-10-2012 , 09:29   Re: Maximum ban time
Reply With Quote #5

That sound awesome can't wait to see what you come up with the solve this little dilemma
Cerobug is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-10-2012 , 22:33   Re: Maximum ban time
Reply With Quote #6

I have one that works for the command sm_ban, but you'll need to tweak the adminmenu so the admins cannot use the menu to ban for longer than n minutes.

Basically, something like this should do it - but like I said, I was still able to pull up my adminmenu (which I didn't alter) and use that ban menu:

PHP Code:
#pragma semicolon 1
#include <sourcemod>

public OnPluginStart()
{
    
AddCommandListener(Command_TempBan"sm_ban");
}

public 
Action:Command_TempBan(client, const String:command[], argc)
{
    if (!
client || CheckCommandAccess(client"allow_perm_bans"ADMFLAG_CUSTOM4))
    {
        return 
Plugin_Continue;
    }
    
    new 
String:time[5];
    
GetCmdArg(2timesizeof(time));
    
    new 
itime StringToInt(time);
    
    if (
itime == || itime 60)
    {
        
PrintToChat(client"You are not allowed to ban for [%i] minutes"itime);
        return 
Plugin_Stop;
    }
    
    return 
Plugin_Continue;

__________________
View my Plugins | Donate

Last edited by TnTSCS; 04-10-2012 at 22:37.
TnTSCS is offline
Cerobug
Member
Join Date: Jun 2008
Old 04-11-2012 , 13:00   Re: Maximum ban time
Reply With Quote #7

So this should work along side sourcebans and limit anyone without ADMFLAG_CUSTOM4 to a max of 1 hour bans once i make custom a custom admin menu and remove some time limits, and is there a way to add another section to that that would say allow a certain flag have 60 min bans max, ADMFLAG_CUSTOM3 1 week bans max, and keep ADMFLAG_CUSTOM4 keep perm bans so I could have 3 different groups with 3 different time limits?

Last edited by Cerobug; 04-11-2012 at 13:15.
Cerobug is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-11-2012 , 17:09   Re: Maximum ban time
Reply With Quote #8

I don't have, nor have I used, sourcebans... as long as sourcebans works with the sm_ban command, this will work - in effect, it looks at the arguments of the sm_ban command, specifically the time element, and adjusts it if it's out of acceptable range. The above can be enhanced to have CVars where you can define the time limits.
__________________
View my Plugins | Donate
TnTSCS is offline
Cerobug
Member
Join Date: Jun 2008
Old 04-11-2012 , 17:38   Re: Maximum ban time
Reply With Quote #9

It does work along side sourcebans perfectly as long as you use /ban from chat but the admin menu still bans. Is there a way that you could set it up to also keep it from allowing the bans to be placed through the admin menu or will I have to make a custom one no matter what? and could you set it up to have cvar access (cfg file) so i could define which flag would have which time limit say something like this with say 6 different sm_limitban1-6 so there could be up to 6 different groups.



// This file was auto-generated by SourceMod (v1.4.1)
// ConVars for plugin "sm_limitban.smx"


// Select which flag and time you would like to set (which flag and time in minutes)
// Ex. "ADMFLAG_CUSTOM1,60"
sm_limitban1 "ADMFLAG_CUSTOM1,60"

// Select which flag and time you would like to set (which flag and time in minutes)
// Ex. "ADMFLAG_CUSTOM2,60"
sm_limitban2 "ADMFLAG_CUSTOM2,120"

// Select which flag and time you would like to set (which flag and time in minutes)
// Ex. "ADMFLAG_CUSTOM4,60"
sm_limitban3 "ADMFLAG_CUSTOM4,0"

Last edited by Cerobug; 04-11-2012 at 20:56.
Cerobug is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 04-21-2012 , 07:26   Re: Maximum ban time
Reply With Quote #10

You can't block the banning via admin menu without modifying the sourcecode of sourcebans.
This plugin could handle the command banning or some other kind of ban via a different plugin, but since sourcebans adds the bans to it's database simultaneously to calling BanClient, blocking the OnBanClient forward doesn't help here. Sourcebans always bans for 5 minutes locally, so one can't check the time in that callback anyways.

Put the bantimelimit.cfg in your sourcemod/configs folder. I didn't test it, but as said, you'd need to modify sourcebans intially to limit the ban times properly
Attached Files
File Type: sp Get Plugin or Get Source (bantimelimit.sp - 712 views - 2.9 KB)
File Type: cfg bantimelimit.cfg (282 Bytes, 336 views)
__________________
Peace-Maker 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 15:25.


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