SourceMod now does authentication in core; admin-auth gets removed. this has an added bonus that OnClientAuthorized reliably has whether an admin is validated
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40936
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
/**
|
||||
* admin-auth.sp
|
||||
* Authenticates admins.
|
||||
* This file is part of SourceMod, Copyright (C) 2004-2007 AlliedModders LLC
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <sourcemod>
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = "Admin Auth",
|
||||
author = "AlliedModders LLC",
|
||||
description = "Authenticates Admins",
|
||||
version = SOURCEMOD_VERSION,
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
public OnClientAuthorized(client, const String:auth[])
|
||||
{
|
||||
if (StrEqual(auth, "BOT")
|
||||
|| StrEqual(auth, "STEAM_ID_LAN"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new AdminId:id
|
||||
if ((id = FindAdminByIdentity("steam", auth)) == INVALID_ADMIN_ID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
decl String:buffer[256], String:account[64];
|
||||
|
||||
FormatUserLogText(client, buffer, sizeof(buffer));
|
||||
|
||||
if (GetAdminUsername(id, account, sizeof(account)))
|
||||
{
|
||||
LogMessage("%s authenticated to account \"%s\"", buffer, account);
|
||||
} else {
|
||||
LogMessage("%s authenticated to an anonymous account", buffer);
|
||||
}
|
||||
|
||||
SetUserAdmin(client, id);
|
||||
}
|
||||
@@ -49,8 +49,8 @@ public OnPluginStart()
|
||||
RegAdminCmd("sm_who", Command_Who, ADMFLAG_GENERIC, "sm_who [#userid|name]");
|
||||
RegAdminCmd("sm_ban", Command_Ban, ADMFLAG_BAN, "sm_ban <#userid|name> <minutes|0> [reason]");
|
||||
RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban <steamid>");
|
||||
RegAdminCmd("sm_addban", Command_AddBan, ADMFLAG_ROOT, "sm_addban <time> <steamid> [reason]");
|
||||
RegAdminCmd("sm_banip", Command_BanIp, ADMFLAG_ROOT, "sm_banip <time> <ip> [reason]");
|
||||
RegAdminCmd("sm_addban", Command_AddBan, ADMFLAG_RCON, "sm_addban <time> <steamid> [reason]");
|
||||
RegAdminCmd("sm_banip", Command_BanIp, ADMFLAG_RCON, "sm_banip <time> <ip> [reason]");
|
||||
|
||||
hBanForward = CreateGlobalForward("OnClientBanned", ET_Ignore, Param_Cell, Param_Cell, Param_Cell, Param_String);
|
||||
hAddBanForward = CreateGlobalForward("OnBanAdded", ET_Ignore, Param_Cell, Param_String, Param_Cell, Param_String);
|
||||
|
||||
Reference in New Issue
Block a user