PDA

View Full Version : [ Check admin ]


Colex
11-13-2014, 08:02
How do I check if the admin is in admins_simple.txt?

example:

is_admin (player)
return true;
else
return false;

Powerlord
11-13-2014, 09:47
Unless there's a specific reason you don't want to have an override for it, generally you'll want to use the CheckCommandAccess (https://sm.alliedmods.net/api/index.php?fastload=show&id=497&) command.

i.e.
if (CheckCommandAccess(player, "myoverride", ADMFLAG_GENERIC, true))
(true for the last argument makes it not look for a command with the name "myoverride")

ESK0
11-13-2014, 11:15
:))))

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

WildCard65
11-13-2014, 11:23
:))))

stock bool:IsPlayerAdmin(player)
{
if (CheckCommandAccess(player, "sm_admin", ADMFLAG_GENERIC, true))
{
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:
if (CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC))

Colex
11-13-2014, 13:53
Not work...

public open_the_motd(player)
{
if (!CheckCommandAccess(player, "sm_admin", ADMFLAG_GENERIC, true)) // Motd only for normal players
ShowMOTDPanel(player, "Motd", "http://url.com", MOTDPANEL_TYPE_URL);
}

Colex
11-13-2014, 14:08
It is for use in TF2.

WildCard65
11-13-2014, 17:33
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.