This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[ Check admin ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Colex
Senior Member
Join Date: Feb 2014
Old 11-13-2014 , 08:02   [ Check admin ]
Reply With Quote #1

How do I check if the admin is in admins_simple.txt?

example:

PHP Code:
is_admin (player)
return 
true;
else
return 
false
Colex is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-13-2014 , 09:47   Re: [ Check admin ]
Reply With Quote #2

Unless there's a specific reason you don't want to have an override for it, generally you'll want to use the CheckCommandAccess command.

i.e.
PHP Code:
if (CheckCommandAccess(player"myoverride"ADMFLAG_GENERICtrue)) 
(true for the last argument makes it not look for a command with the name "myoverride")
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
ESK0
BANNED
Join Date: May 2014
Location: Czech Republic
Old 11-13-2014 , 11:15   Re: [ Check admin ]
Reply With Quote #3

)))
PHP Code:
stock bool:IsPlayerAdmin(player)
{
    if (
CheckCommandAccess(player"sm_admin"ADMFLAG_GENERICtrue))
    {
        return 
true;
    }
    else
    {
        return 
false;
    }
}
Use:
if( 
IsPlayerAdmin(client))
{
    
//todo...


Last edited by ESK0; 11-13-2014 at 11:16.
ESK0 is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-13-2014 , 11:23   Re: [ Check admin ]
Reply With Quote #4

Quote:
Originally Posted by ESK0 View Post
)))
PHP Code:
stock bool:IsPlayerAdmin(player)
{
    if (
CheckCommandAccess(player"sm_admin"ADMFLAG_GENERICtrue))
    {
        return 
true;
    }
    else
    {
        return 
false;
    }
}
Use:
if( 
IsPlayerAdmin(client))
{
    
//todo...

Um, that is the most REDUNDANT piece of code I've seen, instead of your way, just use:
PHP Code:
if (CheckCommandAccess(client"sm_admin"ADMFLAG_GENERIC)) 
__________________

Last edited by WildCard65; 11-13-2014 at 11:23.
WildCard65 is offline
Colex
Senior Member
Join Date: Feb 2014
Old 11-13-2014 , 13:53   Re: [ Check admin ]
Reply With Quote #5

Not work...

PHP Code:
public open_the_motd(player)
{
    if (!
CheckCommandAccess(player"sm_admin"ADMFLAG_GENERICtrue)) // Motd only for normal players
        
ShowMOTDPanel(player"Motd""http://url.com"MOTDPANEL_TYPE_URL);


Last edited by Colex; 11-13-2014 at 13:53. Reason: PHP code tag
Colex is offline
Colex
Senior Member
Join Date: Feb 2014
Old 11-13-2014 , 14:08   Re: [ Check admin ]
Reply With Quote #6

It is for use in TF2.
Colex is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-13-2014 , 17:33   Re: [ Check admin ]
Reply With Quote #7

the boolean arg on the end of CheckCommandAccess makes it so only the player is checked against the 3rd arg.
Also your if statement reads like this: If player does NOT have the generic admin flag, then show a motd panel
Plz note, if your an admin with b or z flag, you won't be able to see the panel.
__________________

Last edited by WildCard65; 11-13-2014 at 17:34.
WildCard65 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 19:01.


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