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

check if is admin?


Post New Thread Reply   
 
Thread Tools Display Modes
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 04-07-2013 , 12:08   Re: check if is admin?
Reply With Quote #11

Quote:
Originally Posted by St00ne View Post
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_Generic, Access_Reservation)) {
(and also the difference with Access_Effective and Access_Real...)

Thanks,

St00ne
PHP Code:
enum AdmAccessMode
{
    
Access_Real,        /**< Access the user has inherently */
    
Access_Effective,    /**< Access the user has from their groups */
}; 
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING
minimoney1 is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 04-09-2013 , 01:59   Re: check if is admin?
Reply With Quote #12

It makes me notice I made a mistake in my example (Access_Reservation doesn't mean anything...)

Anyway,

Let's say I'll give up with this and only use CheckCommandAccess.

Quote:
Originally Posted by TnTSCS View Post
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;

Need to be sure: instead of "generic_admin", I should have a command right?
(part removed)

Lately I tried to use it this way and it seems to work fine:

Code:
public OnClientPostAdminCheck(client)
{
    if (CheckCommandAccess(client, "sm_map", ADMFLAG_CHANGEMAP, true))
    {
        g_bPlayerIsAdmin[client] = true;
    }
}
I'm a bit confused when I read this:

Quote:
If true, SourceMod will not attempt to find a matching command, and it will only use the default flags specified. Otherwise, SourceMod will ignore the default flags if there is a matching admin command.

Notes: Returns whether a client has access to a given command string. The string can be any override string, as overrides can be independent of commands. This feature essentially allows you to create custom flags using the override system.

Return: True if the client has access, false otherwise.

Version Added:1.0.0.1946

"CheckCommandAccess looks through all overrides for a match, then all admin commands, and then finally the passed in flags". "override_only skips the commands, as it's very slow, only looking at overrides (and the fallback flags)"
Wait: The string can be any override string, as overrides can be independent of commands.

So "generic_admin", even if it's not a command, can work?

Thx

St00ne

PS: Anyway I'm starting to try all situations (editing this part, compiling and testing) since the rest of my plugin is ready.
Don't get mad at helping me here...
__________________

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

Last edited by St00ne; 04-09-2013 at 13:38. Reason: removed incorrect assumptions
St00ne is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 04-09-2013 , 07:59   Re: check if is admin?
Reply With Quote #13

  • You can use any string you want, unless it's fundamentally tied to the functionality of an existing command, it should be something that uniquely identifies that feature.
  • The last bool should be set to false if you're using an existing command, true if you're using a custom string.
__________________
asherkin is offline
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 04-09-2013 , 13:36   Re: check if is admin?
Reply With Quote #14

Ok, it's clear now, thanks a lot.

++
__________________

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

Last edited by St00ne; 04-09-2013 at 13:48.
St00ne 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 13:40.


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