plugins/admin-auth.sp
author David Anderson <dvander@alliedmods.net>
Sat Mar 03 08:11:40 2007 +0000 (2007-03-03)
changeset 568 dff0d4cb9d18
parent 460 0be67c5566c6
child 902 7cf6f3696164
permissions -rw-r--r--
removed Metamod from the build list, it was pointless
     1 /**
     2  * admin-flatfile.sp
     3  * Manages the standard flat files for admins.  This is the file to compile.
     4  * This file is part of SourceMod, Copyright (C) 2004-2007 AlliedModders LLC
     5  *
     6  * This program is free software; you can redistribute it and/or
     7  * modify it under the terms of the GNU General Public License
     8  * as published by the Free Software Foundation; either version 2
     9  * of the License, or (at your option) any later version.
    10  *
    11  * This program is distributed in the hope that it will be useful,
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  * GNU General Public License for more details.
    15  * 
    16  * You should have received a copy of the GNU General Public License
    17  * along with this program; if not, write to the Free Software
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    19  */
    20 
    21 
    22 #include <sourcemod>
    23 
    24 public Plugin:myinfo = 
    25 {
    26 	name = "Admin Auth",
    27 	author = "AlliedModders LLC",
    28 	description = "Authenticates Admins",
    29 	version = "1.0.0.0",
    30 	url = "http://www.sourcemod.net/"
    31 };
    32 
    33 public OnClientAuthorized(client, const String:auth[])
    34 {
    35 	if (StrEqual(auth, "BOT")
    36 		|| StrEqual(auth, "STEAM_ID_LAN"))
    37 	{
    38 		return;
    39 	}
    40 	
    41 	new AdminId:id
    42 	if ((id = FindAdminByIdentity("steam", auth)) == INVALID_ADMIN_ID)
    43 	{
    44 		return;
    45 	}
    46 	
    47 	decl String:buffer[256], String:account[64];
    48 	
    49 	FormatUserLogText(client, buffer, sizeof(buffer));
    50 	
    51 	if (GetAdminUsername(id, account, sizeof(account)))
    52 	{
    53 		LogMessage("%s authenticated to account \"%s\"", buffer, account);
    54 	} else {
    55 		LogMessage("%s authenticated to an anonymous account", buffer);
    56 	}
    57 	
    58 	SetUserAdmin(client, id);
    59 }