Initial commit

This commit is contained in:
2025-04-15 22:27:20 -04:00
parent 5b7b68f81f
commit 771d8fe8e8
597 changed files with 149544 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basecommands Plugin
* Provides cancelvote functionality.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
void PerformCancelVote(int client)
{
if (!IsVoteInProgress())
{
ReplyToCommand(client, "[SM] %t", "Vote Not In Progress");
return;
}
ShowActivity2(client, "[SM] ", "%t", "Cancelled Vote");
LogAction(client, -1, "\"%L\" Cancelled the vote.", client);
CancelVote();
}
public void AdminMenu_CancelVote(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Cancel vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
PerformCancelVote(param);
RedisplayAdminMenu(topmenu, param);
}
else if (action == TopMenuAction_DrawOption)
{
buffer[0] = IsVoteInProgress() ? ITEMDRAW_DEFAULT : ITEMDRAW_IGNORE;
}
}
public Action Command_CancelVote(int client, int args)
{
PerformCancelVote(client);
return Plugin_Handled;
}

View File

@@ -0,0 +1,170 @@
/**
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod Basecommands Plugin
* Provides exec cfg functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
Menu g_ConfigMenu = null;
void PerformExec(int client, char[] path)
{
if (!FileExists(path))
{
ReplyToCommand(client, "[SM] %t", "Config not found", path[4]);
return;
}
ShowActivity2(client, "[SM] ", "%t", "Executed config", path[4]);
LogAction(client, -1, "\"%L\" executed config (file \"%s\")", client, path[4]);
ServerCommand("exec \"%s\"", path[4]);
}
public void AdminMenu_ExecCFG(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Exec CFG", param);
}
else if (action == TopMenuAction_SelectOption)
{
g_ConfigMenu.Display(param, MENU_TIME_FOREVER);
}
}
public int MenuHandler_ExecCFG(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char path[256];
menu.GetItem(param2, path, sizeof(path));
PerformExec(param1, path);
}
else if (action == MenuAction_Display)
{
char title[128];
Format(title, sizeof(title), "%T", "Choose Config", param1);
Panel panel = view_as<Panel>(param2);
panel.SetTitle(title);
}
return 0;
}
public Action Command_ExecCfg(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_execcfg <filename>");
return Plugin_Handled;
}
char path[64] = "cfg/";
GetCmdArg(1, path[4], sizeof(path)-4);
PerformExec(client, path);
return Plugin_Handled;
}
SMCParser config_parser;
void ParseConfigs()
{
if (!config_parser)
config_parser = new SMCParser();
config_parser.OnEnterSection = NewSection;
config_parser.OnLeaveSection = EndSection;
config_parser.OnKeyValue = KeyValue;
if (g_ConfigMenu != null)
{
delete g_ConfigMenu;
}
g_ConfigMenu = new Menu(MenuHandler_ExecCFG, MenuAction_Display);
g_ConfigMenu.SetTitle("%T", "Choose Config", LANG_SERVER);
g_ConfigMenu.ExitBackButton = true;
char configPath[256];
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/adminmenu_cfgs.txt");
if (!FileExists(configPath))
{
LogError("Unable to locate exec config file, no maps loaded.");
return;
}
int line;
SMCError err = config_parser.ParseFile(configPath, line);
if (err != SMCError_Okay)
{
char error[256];
SMC_GetErrorString(err, error, sizeof(error));
LogError("Could not parse file (line %d, file \"%s\"):", line, configPath);
LogError("Parser encountered error: %s", error);
}
return;
}
public SMCResult NewSection(SMCParser smc, const char[] name, bool opt_quotes)
{
return SMCParse_Continue;
}
public SMCResult KeyValue(SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes)
{
g_ConfigMenu.AddItem(key, value);
return SMCParse_Continue;
}
public SMCResult EndSection(SMCParser smc)
{
return SMCParse_Continue;
}

View File

@@ -0,0 +1,221 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basecommands Plugin
* Provides kick functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
void PerformKick(int client, int target, const char[] reason)
{
LogAction(client, target, "\"%L\" kicked \"%L\" (reason \"%s\")", client, target, reason);
if (reason[0] == '\0')
{
KickClient(target, "%t", "Kicked by admin");
}
else
{
KickClient(target, "%s", reason);
}
}
void DisplayKickMenu(int client)
{
Menu menu = new Menu(MenuHandler_Kick);
char title[100];
Format(title, sizeof(title), "%T:", "Kick player", client);
menu.SetTitle(title);
menu.ExitBackButton = CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC, false);
AddTargetsToMenu(menu, client, false, false);
menu.Display(client, MENU_TIME_FOREVER);
}
public void AdminMenu_Kick(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Kick player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayKickMenu(param);
}
}
public int MenuHandler_Kick(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_s", name);
PerformKick(param1, target, "");
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayKickMenu(param1);
}
}
return 0;
}
public Action Command_Kick(int client, int args)
{
if (args < 1)
{
if ((GetCmdReplySource() == SM_REPLY_TO_CHAT) && (client != 0))
{
DisplayKickMenu(client);
}
else
{
ReplyToCommand(client, "[SM] Usage: sm_kick <#userid|name> [reason]");
}
return Plugin_Handled;
}
char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));
char arg[65];
int len = BreakString(Arguments, arg, sizeof(arg));
if (len == -1)
{
/* Safely null terminate */
len = 0;
Arguments[0] = '\0';
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_CONNECTED,
target_name,
sizeof(target_name),
tn_is_ml)) > 0)
{
char reason[64];
Format(reason, sizeof(reason), Arguments[len]);
if (tn_is_ml)
{
if (reason[0] == '\0')
{
ShowActivity2(client, "[SM] ", "%t", "Kicked target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Kicked target reason", target_name, reason);
}
}
else
{
if (reason[0] == '\0')
{
ShowActivity2(client, "[SM] ", "%t", "Kicked target", "_s", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Kicked target reason", "_s", target_name, reason);
}
}
int kick_self = 0;
for (int i = 0; i < target_count; i++)
{
/* Kick everyone else first */
if (target_list[i] == client)
{
kick_self = client;
}
else
{
PerformKick(client, target_list[i], reason);
}
}
if (kick_self)
{
PerformKick(client, client, reason);
}
}
else
{
ReplyToTargetError(client, target_count);
}
return Plugin_Handled;
}

View File

@@ -0,0 +1,171 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basecommands Plugin
* Provides map functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
public int MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char map[PLATFORM_MAX_PATH];
menu.GetItem(param2, map, sizeof(map));
ShowActivity2(param1, "[SM] ", "%t", "Changing map", map);
LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
DataPack dp;
CreateDataTimer(3.0, Timer_ChangeMap, dp);
dp.WriteString(map);
}
else if (action == MenuAction_Display)
{
char title[128];
Format(title, sizeof(title), "%T", "Please select a map", param1);
Panel panel = view_as<Panel>(param2);
panel.SetTitle(title);
}
return 0;
}
public void AdminMenu_Map(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Choose Map", param);
}
else if (action == TopMenuAction_SelectOption)
{
g_MapList.Display(param, MENU_TIME_FOREVER);
}
}
public Action Command_Map(int client, int args)
{
if (args < 1)
{
if ((GetCmdReplySource() == SM_REPLY_TO_CHAT) && (client != 0))
{
g_MapList.SetTitle("%T", "Choose Map", client);
g_MapList.Display(client, MENU_TIME_FOREVER);
}
else
{
ReplyToCommand(client, "[SM] Usage: sm_map <map>");
}
return Plugin_Handled;
}
char map[PLATFORM_MAX_PATH];
char displayName[PLATFORM_MAX_PATH];
GetCmdArg(1, map, sizeof(map));
if (FindMap(map, displayName, sizeof(displayName)) == FindMap_NotFound)
{
ReplyToCommand(client, "[SM] %t", "Map was not found", map);
return Plugin_Handled;
}
GetMapDisplayName(displayName, displayName, sizeof(displayName));
ShowActivity2(client, "[SM] ", "%t", "Changing map", displayName);
LogAction(client, -1, "\"%L\" changed map to \"%s\" (input \"%s\")", client, displayName, map);
DataPack dp;
CreateDataTimer(3.0, Timer_ChangeMap, dp);
dp.WriteString(map);
return Plugin_Handled;
}
public Action Timer_ChangeMap(Handle timer, DataPack dp)
{
char map[PLATFORM_MAX_PATH];
dp.Reset();
dp.ReadString(map, sizeof(map));
ForceChangeLevel(map, "sm_map Command");
return Plugin_Stop;
}
Handle g_map_array = null;
int g_map_serial = -1;
int LoadMapList(Menu menu)
{
Handle map_array;
if ((map_array = ReadMapList(g_map_array,
g_map_serial,
"sm_map menu",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER))
!= null)
{
g_map_array = map_array;
}
if (g_map_array == null)
{
return 0;
}
menu.RemoveAllItems();
char map_name[PLATFORM_MAX_PATH];
int map_count = GetArraySize(g_map_array);
for (int i = 0; i < map_count; i++)
{
char displayName[PLATFORM_MAX_PATH];
GetArrayString(g_map_array, i, map_name, sizeof(map_name));
GetMapDisplayName(map_name, displayName, sizeof(displayName));
menu.AddItem(map_name, displayName);
}
return map_count;
}

View File

@@ -0,0 +1,67 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basecommands Plugin
* Provides reloadadmins functionality.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
void PerformReloadAdmins(int client)
{
/* Dump it all! */
DumpAdminCache(AdminCache_Groups, true);
DumpAdminCache(AdminCache_Overrides, true);
LogAction(client, -1, "\"%L\" refreshed the admin cache.", client);
ReplyToCommand(client, "[SM] %t", "Admin cache refreshed");
}
public void AdminMenu_ReloadAdmins(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Reload admins", param);
}
else if (action == TopMenuAction_SelectOption)
{
PerformReloadAdmins(param);
RedisplayAdminMenu(topmenu, param);
}
}
public Action Command_ReloadAdmins(int client, int args)
{
PerformReloadAdmins(client);
return Plugin_Handled;
}

View File

@@ -0,0 +1,264 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basecommands Plugin
* Provides sm_who functionality
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
void PerformWho(int client, int target, ReplySource reply, bool is_admin)
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
bool show_name = false;
char admin_name[MAX_NAME_LENGTH];
AdminId id = GetUserAdmin(target);
if (id != INVALID_ADMIN_ID && id.GetUsername(admin_name, sizeof(admin_name)))
{
show_name = true;
}
ReplySource old_reply = SetCmdReplySource(reply);
if (id == INVALID_ADMIN_ID)
{
ReplyToCommand(client, "[SM] %t", "Player is not an admin", name);
}
else
{
if (!is_admin)
{
ReplyToCommand(client, "[SM] %t", "Player is an admin", name);
}
else
{
int flags = GetUserFlagBits(target);
char flagstring[255];
if (flags == 0)
{
strcopy(flagstring, sizeof(flagstring), "none");
}
else if (flags & ADMFLAG_ROOT)
{
strcopy(flagstring, sizeof(flagstring), "root");
}
else
{
FlagsToString(flagstring, sizeof(flagstring), flags);
}
if (show_name)
{
ReplyToCommand(client, "[SM] %t", "Admin logged in as", name, admin_name, flagstring);
}
else
{
ReplyToCommand(client, "[SM] %t", "Admin logged in anon", name, flagstring);
}
}
}
SetCmdReplySource(old_reply);
}
void DisplayWhoMenu(int client)
{
Menu menu = new Menu(MenuHandler_Who);
char title[100];
Format(title, sizeof(title), "%T:", "Identify player", client);
menu.SetTitle(title);
menu.ExitBackButton = CheckCommandAccess(client, "sm_admin", ADMFLAG_GENERIC, false);
AddTargetsToMenu2(menu, 0, COMMAND_FILTER_CONNECTED);
menu.Display(client, MENU_TIME_FOREVER);
}
public void AdminMenu_Who(TopMenu topmenu,
TopMenuAction action,
TopMenuObject object_id,
int param,
char[] buffer,
int maxlength)
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Identify player", param);
}
else if (action == TopMenuAction_SelectOption)
{
DisplayWhoMenu(param);
}
}
public int MenuHandler_Who(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_Cancel)
{
if (param2 == MenuCancel_ExitBack && hTopMenu)
{
hTopMenu.Display(param1, TopMenuPosition_LastCategory);
}
}
else if (action == MenuAction_Select)
{
char info[32];
int userid, target;
menu.GetItem(param2, info, sizeof(info));
userid = StringToInt(info);
if ((target = GetClientOfUserId(userid)) == 0)
{
PrintToChat(param1, "[SM] %t", "Player no longer available");
}
else if (!CanUserTarget(param1, target))
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else
{
PerformWho(param1, target, SM_REPLY_TO_CHAT, (GetUserFlagBits(param1) != 0 ? true : false));
}
/* Re-draw the menu if they're still valid */
/* - Close the menu? redisplay? jump back up to the category?
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplayWhoMenu(param1);
}
*/
}
return 0;
}
public Action Command_Who(int client, int args)
{
bool is_admin = false;
if (!client || (client && GetUserFlagBits(client) != 0))
{
is_admin = true;
}
if (args < 1)
{
/* Display header */
char t_access[16], t_name[16], t_username[16];
Format(t_access, sizeof(t_access), "%T", "Admin access", client);
Format(t_name, sizeof(t_name), "%T", "Name", client);
Format(t_username, sizeof(t_username), "%T", "Username", client);
if (is_admin)
{
PrintToConsole(client, " %-24.23s %-18.17s %s", t_name, t_username, t_access);
}
else
{
PrintToConsole(client, " %-24.23s %s", t_name, t_access);
}
/* List all players */
char flagstring[255];
for (int i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i))
{
continue;
}
int flags = GetUserFlagBits(i);
AdminId id = GetUserAdmin(i);
if (flags == 0)
{
strcopy(flagstring, sizeof(flagstring), "none");
}
else if (flags & ADMFLAG_ROOT)
{
strcopy(flagstring, sizeof(flagstring), "root");
}
else
{
FlagsToString(flagstring, sizeof(flagstring), flags);
}
char name[MAX_NAME_LENGTH];
char username[MAX_NAME_LENGTH];
GetClientName(i, name, sizeof(name));
if (id != INVALID_ADMIN_ID)
{
id.GetUsername(username, sizeof(username));
}
if (is_admin)
{
PrintToConsole(client, "%2d. %-24.23s %-18.17s %s", i, name, username, flagstring);
}
else
{
if (flags == 0)
{
PrintToConsole(client, "%2d. %-24.23s %t", i, name, "No");
}
else
{
PrintToConsole(client, "%2d. %-24.23s %t", i, name, "Yes");
}
}
}
if (GetCmdReplySource() == SM_REPLY_TO_CHAT)
{
ReplyToCommand(client, "[SM] %t", "See console for output");
}
return Plugin_Handled;
}
char arg[65];
GetCmdArg(1, arg, sizeof(arg));
int target = FindTarget(client, arg, false, false);
if (target == -1)
{
return Plugin_Handled;
}
PerformWho(client, target, GetCmdReplySource(), is_admin);
return Plugin_Handled;
}