Raised This Month: $51 Target: $400
 12% 

check if is admin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 07-13-2009 , 09:51   check if is admin?
Reply With Quote #1

i can't find the function is_user_admin() for sourcemod. someone help me? +k..
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 07-13-2009 , 11:08   Re: check if is admin?
Reply With Quote #2

thanks
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Kevin_b_er
SourceMod Donor
Join Date: Feb 2009
Old 07-13-2009 , 22:12   Re: check if is admin?
Reply With Quote #3

I can't remember for sure but that might fail on 'root' access admins. You would need to check both the regular flag and the root flag in this case. It's definitely a problem for the bitfield version of access checking.
Kevin_b_er is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 07-13-2009 , 22:14   Re: check if is admin?
Reply With Quote #4

Quote:
Originally Posted by Kevin_b_er View Post
I can't remember for sure but that might fail on 'root' access admins. You would need to check both the regular flag and the root flag in this case. It's definitely a problem for the bitfield version of access checking.
I wish I knew what the hell you were talking about, it would greatly aid in the creation of plugins x_x
Dragonshadow is offline
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 07-14-2009 , 00:40   Re: check if is admin?
Reply With Quote #5

Quote:
Originally Posted by Kevin_b_er View Post
I can't remember for sure but that might fail on 'root' access admins. You would need to check both the regular flag and the root flag in this case. It's definitely a problem for the bitfield version of access checking.
The check just fails if you set the AccessMode to "Access_Real" on root-Admins,
it works fine with "Access_Effective" like it's default for psychonic's
example.

Another easy method would be just checking if the player has ANY admin rigths with
PHP Code:
if(GetUserAdmin(client) != INVALID_ADMIN_ID)
{
 
// This is an Admin, do code here!
}
else
{
 
// NOT an Admin do other code here!

FeuerSturm is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 04-07-2013 , 03:23   Re: check if is admin?
Reply With Quote #6

Hi,

Sorry to revive such old topic, but:

I noticed that players being set in admins.cfg without any flag, or with the 'a' flag (which normally is not an admin flag) are considered as admins if you use:

Code:
if(GetUserAdmin(client) != INVALID_ADMIN_ID){
So, in order to make a plugin which excludes 'admins with a flag', I'd like to know the difference between:

Code:
if (!GetAdminFlag(GetUserAdmin(client), Admin_Reservation)) {
and

Code:
if (!GetAdminFlag(GetUserAdmin(client), Admin_Reservation, Access_Effective)) {
(and also the difference with Access_Effective and Access_Real...)

Thanks,

St00ne
__________________

*** *** ***
-My plugins-

Last edited by St00ne; 04-09-2013 at 01:54.
St00ne is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 04-07-2013 , 04:14   Re: check if is admin?
Reply With Quote #7

Access_Effective is the default, so there is no difference there.

However, neither of those methods should be used, the correct native is CheckCommandAccess.
__________________
asherkin is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 04-07-2013 , 05:42   Re: check if is admin?
Reply With Quote #8

Hi,

Thanks for the advice.

I see you already gave a few info about CheckCommandAccess, on this forum, so I'll do with it.

++
__________________

*** *** ***
-My plugins-
St00ne is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 04-07-2013 , 11:00   Re: check if is admin?
Reply With Quote #9

I don't even know from where you're using Access_Reservation. As far as the enum goes it uses:

PHP Code:
enum AdmAccessMode
{
    
Access_Real,        /**< Access the user has inherently */
    
Access_Effective,    /**< Access the user has from their groups */
}; 
But yes, either way, use CheckCommandAccess. The system is there so that server operators may override any commands should you provide the capability.
__________________

Last edited by 11530; 04-07-2013 at 11:02.
11530 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-07-2013 , 11:28   Re: check if is admin?
Reply With Quote #10

Something like this - just one way to skin this cat... you can get pretty creative with the overrides and what not.

PHP Code:
bool:IsPlayerGenericAdmin(client)
{
    if (
CheckCommandAccess(client"generic_admin"ADMFLAG_GENERICfalse))
    {
        return 
true;
    }

    return 
false;

__________________
View my Plugins | Donate
TnTSCS 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 06:28.


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