plugins/basecommands/reloadadmins.sp
author Peace-Maker <januk@freenet.de>
Sat May 10 05:42:33 2014 -0700 (2014-05-10)
changeset 4354 7011587e0021
parent 2289 44045ead61cd
permissions -rw-r--r--
Remove LogMessageEx definition from logging.inc (bug 5897, r=kyles).
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod Basecommands Plugin
     5  * Provides reloadadmins functionality.
     6  *
     7  * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     8  * =============================================================================
     9  *
    10  * This program is free software; you can redistribute it and/or modify it under
    11  * the terms of the GNU General Public License, version 3.0, as published by the
    12  * Free Software Foundation.
    13  * 
    14  * This program is distributed in the hope that it will be useful, but WITHOUT
    15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    17  * details.
    18  *
    19  * You should have received a copy of the GNU General Public License along with
    20  * this program.  If not, see <http://www.gnu.org/licenses/>.
    21  *
    22  * As a special exception, AlliedModders LLC gives you permission to link the
    23  * code of this program (as well as its derivative works) to "Half-Life 2," the
    24  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    25  * by the Valve Corporation.  You must obey the GNU General Public License in
    26  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    27  * this exception to all derivative works.  AlliedModders LLC defines further
    28  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    29  * or <http://www.sourcemod.net/license.php>.
    30  *
    31  * Version: $Id$
    32  */
    33  
    34 PerformReloadAdmins(client)
    35 {
    36 	/* Dump it all! */
    37 	DumpAdminCache(AdminCache_Groups, true);
    38 	DumpAdminCache(AdminCache_Overrides, true);
    39 
    40 	LogAction(client, -1, "\"%L\" refreshed the admin cache.", client);
    41 	ReplyToCommand(client, "[SM] %t", "Admin cache refreshed");
    42 }
    43 
    44 public AdminMenu_ReloadAdmins(Handle:topmenu, 
    45 							  TopMenuAction:action,
    46 							  TopMenuObject:object_id,
    47 							  param,
    48 							  String:buffer[],
    49 							  maxlength)
    50 {
    51 	if (action == TopMenuAction_DisplayOption)
    52 	{
    53 		Format(buffer, maxlength, "%T", "Reload admins", param);
    54 	}
    55 	else if (action == TopMenuAction_SelectOption)
    56 	{
    57 		PerformReloadAdmins(param);
    58 		RedisplayAdminMenu(topmenu, param);	
    59 	}
    60 }
    61 
    62 public Action:Command_ReloadAdmins(client, args)
    63 {
    64 	PerformReloadAdmins(client);
    65 
    66 	return Plugin_Handled;
    67 }