AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Limit ban time with admin levels (https://forums.alliedmods.net/showthread.php?t=141449)

GarbageBox 10-24-2010 07:07

Limit ban time with admin levels
 
Can anyone give me a example?
ADMIN_LEVEL_A can ban permanently
ADMIN_LEVEL_B can ban xxx mins

fysiks 10-24-2010 17:27

Re: Limit ban time with admin levels
 
ADMIN_LEVEL_B admins cannot ban permanantly
PHP Code:

if( /* admin has flag ADMIN_LEVEL_B */ )
{
    
// set ban time to xxx


OR

Only ADMIN_LEVEL_A admins can ban permanantly.
PHP Code:

if( /* admin does not have ADMIN_LEVEL_A */ )
{
    
// set ban time to xxx


If neither of these work like you want then please explain in detail how exactly you want it to work. Also, you need to consider what happens if an admin does neither of these flags to decide on which to choose (or if I need to make a different one for you).

GarbageBox 10-25-2010 09:27

Re: Limit ban time with admin levels
 
I want to edit on original ban amxx.
If the admin doesn`t have ADMIN_LEVEL_A and he input amx_ban player 0, will show him a message that show him has been limit max ban time.

fysiks 10-25-2010 11:13

Re: Limit ban time with admin levels
 
Use this then:

PHP Code:

if( !(get_user_flags(id) & ADMIN_LEVEL_A) && ban_time == )
{
    
// Change ban time if you want a fixed ban time
    // OR
    // print message and return PLUGIN_HANDLED if you want them to be able to choose a ban time



GarbageBox 10-26-2010 10:45

Re: Limit ban time with admin levels
 
How about the level b?
Change ban_time == 0 to => 0 && <= X?

fysiks 10-26-2010 19:02

Re: Limit ban time with admin levels
 
Quote:

Originally Posted by GarbageBox (Post 1334378)
How about the level b?
Change ban_time == 0 to => 0 && <= X?

Well, answer me this: Do you only want people with ADMIN_LEVEL_A or ADMIN_LEVEL_B to be able to ban at all? Meaning, if they don't have either of these two flags can they ban?

Also, what do you want to happen when an admin without level A but with level B tries to do a permanent ban? Or tell me what you mean by "level B can ban xxx min".

GarbageBox 10-27-2010 05:19

Re: Limit ban time with admin levels
 
For example:
"loopback" "" "dm" "de" < d is can use the ban command, e is level a.
If the admin has "d", limit the maximum time that he could ban.
I am going to use level a to c.
If the admin without level a and with b but he is trying to ban permanently, show him that what is the maximum time that he can ban

fysiks 10-27-2010 12:54

Re: Limit ban time with admin levels
 
The "de" refers to this:

Code:

; Account flags:
; a - disconnect player on invalid password
; b - clan tag
; c - this is steamid/wonid
; d - this is ip
; e - password is not checked (only name/ip/steamid needed)
; k - name or tag is case sensitive.  eg: if you set it so the name "Ham"
;    is protected and case sensitive (flags "k" only), then anybody
;    can use the names "haM", "HAM", "ham", etc, but not "Ham"

and the "dm" refers to the access flags.

And the flag for ADMIN_LEVEL_A is "m" and for ADMIN_LEVEL_B is "n", see amxconst.inc and users.ini for more information.

EDIT:

Here ya go:

PHP Code:

new iFlags get_user_flags(id)
if( !(
iFlags ADMIN_LEVEL_A) )
{
    if( 
iFlags ADMIN_LEVEL_B )
    {
        if( 
ban_time == || ban_time 60 // max ban time of 60 minutes
        
{
            
console_print(id"Maximum ban time is 60 minutes.  Try again.")
            return 
PLUGIN_HANDLED
            
// OR
            // ban_time = 60 // do not return with this option
        
}
    }
    else
    {
        return 
PLUGIN_HANDLED // Has neither flag ADMIN_LEVEL_A or ADMIN_LEVEL_B
    
}



GarbageBox 10-28-2010 10:52

Re: Limit ban time with admin levels
 
where should i add it?

fysiks 10-28-2010 19:08

Re: Limit ban time with admin levels
 
Quote:

Originally Posted by GarbageBox (Post 1335727)
where should i add it?

That depends on which ban command you want to use it for. You will also likely need to modfiy it so that ban_time is which ever variable is appropriate.

Basically, you would put it right after you know the ban time. That way nothing else happens until if goes through this check.


All times are GMT -4. The time now is 10:25.

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