Raised This Month: $ Target: $400
 0% 

Limit ban time with admin levels


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 10-24-2010 , 07:07   Limit ban time with admin levels
Reply With Quote #1

Can anyone give me a example?
ADMIN_LEVEL_A can ban permanently
ADMIN_LEVEL_B can ban xxx mins
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-24-2010 , 17:27   Re: Limit ban time with admin levels
Reply With Quote #2

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).
__________________

Last edited by fysiks; 10-24-2010 at 17:30.
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 10-25-2010 , 09:27   Re: Limit ban time with admin levels
Reply With Quote #3

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.
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-25-2010 , 11:13   Re: Limit ban time with admin levels
Reply With Quote #4

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

__________________
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 10-26-2010 , 10:45   Re: Limit ban time with admin levels
Reply With Quote #5

How about the level b?
Change ban_time == 0 to => 0 && <= X?
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-26-2010 , 19:02   Re: Limit ban time with admin levels
Reply With Quote #6

Quote:
Originally Posted by GarbageBox View Post
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".
__________________

Last edited by fysiks; 10-26-2010 at 19:13.
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 10-27-2010 , 05:19   Re: Limit ban time with admin levels
Reply With Quote #7

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
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-27-2010 , 12:54   Re: Limit ban time with admin levels
Reply With Quote #8

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
    
}

__________________

Last edited by fysiks; 10-27-2010 at 13:09.
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 10-28-2010 , 10:52   Re: Limit ban time with admin levels
Reply With Quote #9

where should i add it?
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-28-2010 , 19:08   Re: Limit ban time with admin levels
Reply With Quote #10

Quote:
Originally Posted by GarbageBox View Post
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.
__________________
fysiks 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 10:25.


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