2007-06-07 08:17:57 +02:00
|
|
|
/**
|
2007-08-15 08:19:30 +02:00
|
|
|
* vim: set ts=4 :
|
|
|
|
* =============================================================================
|
|
|
|
* SourceMod Basic Commands Plugin
|
2007-06-07 09:22:19 +02:00
|
|
|
* Implements basic admin commands.
|
2007-06-07 08:17:57 +02:00
|
|
|
*
|
2007-08-15 08:19:30 +02:00
|
|
|
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
|
|
|
* =============================================================================
|
2007-06-07 08:17:57 +02:00
|
|
|
*
|
2007-08-15 08:19:30 +02:00
|
|
|
* 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.
|
2007-07-29 21:20:42 +02:00
|
|
|
*
|
2007-08-15 08:19:30 +02:00
|
|
|
* 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>.
|
2007-06-07 09:22:19 +02:00
|
|
|
*
|
|
|
|
* Version: $Id$
|
2007-06-07 08:17:57 +02:00
|
|
|
*/
|
|
|
|
|
2007-06-07 09:22:19 +02:00
|
|
|
#pragma semicolon 1
|
|
|
|
|
2007-06-20 10:51:40 +02:00
|
|
|
#include <sourcemod>
|
|
|
|
|
2007-07-29 21:20:42 +02:00
|
|
|
public Plugin:myinfo =
|
2007-06-07 08:17:57 +02:00
|
|
|
{
|
|
|
|
name = "Basic Commands",
|
|
|
|
author = "AlliedModders LLC",
|
|
|
|
description = "Basic Admin Commands",
|
|
|
|
version = SOURCEMOD_VERSION,
|
|
|
|
url = "http://www.sourcemod.net/"
|
|
|
|
};
|
|
|
|
|
|
|
|
public OnPluginStart()
|
|
|
|
{
|
2007-06-29 09:09:56 +02:00
|
|
|
LoadTranslations("common.phrases");
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 08:17:57 +02:00
|
|
|
RegAdminCmd("sm_kick", Command_Kick, ADMFLAG_KICK, "sm_kick <#userid|name> [reason]");
|
2007-06-07 23:24:29 +02:00
|
|
|
RegAdminCmd("sm_map", Command_Map, ADMFLAG_CHANGEMAP, "sm_map <map>");
|
2007-06-07 23:36:24 +02:00
|
|
|
RegAdminCmd("sm_rcon", Command_Rcon, ADMFLAG_RCON, "sm_rcon <args>");
|
2007-06-08 01:48:51 +02:00
|
|
|
RegAdminCmd("sm_cvar", Command_Cvar, ADMFLAG_CONVARS, "sm_cvar <cvar> [value]");
|
2007-06-08 03:01:44 +02:00
|
|
|
RegAdminCmd("sm_execcfg", Command_ExecCfg, ADMFLAG_CONFIG, "sm_execcfg <filename>");
|
2007-06-08 03:58:26 +02:00
|
|
|
RegAdminCmd("sm_who", Command_Who, ADMFLAG_GENERIC, "sm_who [#userid|name]");
|
2007-07-25 00:20:58 +02:00
|
|
|
RegAdminCmd("sm_reloadadmins", Command_ReloadAdmins, ADMFLAG_BAN, "sm_reloadadmins");
|
2007-08-08 23:32:06 +02:00
|
|
|
RegAdminCmd("sm_cancelvote", Command_CancelVote, ADMFLAG_VOTE, "sm_cancelvote");
|
2007-06-08 07:11:49 +02:00
|
|
|
}
|
|
|
|
|
2007-07-25 00:20:58 +02:00
|
|
|
public Action:Command_ReloadAdmins(client, args)
|
|
|
|
{
|
|
|
|
/* Dump it all! */
|
|
|
|
DumpAdminCache(AdminCache_Groups, true);
|
|
|
|
DumpAdminCache(AdminCache_Overrides, true);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-08-27 04:00:37 +02:00
|
|
|
LogAction(client, -1, "\"%L\" refreshed the admin cache.", client);
|
2007-07-25 00:20:58 +02:00
|
|
|
ReplyToCommand(client, "[SM] %t", "Admin cache refreshed");
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-25 00:20:58 +02:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
#define FLAG_STRINGS 14
|
|
|
|
new String:g_FlagNames[FLAG_STRINGS][20] =
|
|
|
|
{
|
2007-08-26 22:04:01 +02:00
|
|
|
"res",
|
2007-06-08 03:58:26 +02:00
|
|
|
"admin",
|
|
|
|
"kick",
|
|
|
|
"ban",
|
|
|
|
"unban",
|
|
|
|
"slay",
|
|
|
|
"map",
|
|
|
|
"cvars",
|
|
|
|
"cfg",
|
|
|
|
"chat",
|
|
|
|
"vote",
|
|
|
|
"pass",
|
|
|
|
"rcon",
|
|
|
|
"cheat"
|
|
|
|
};
|
|
|
|
|
2007-08-26 22:04:01 +02:00
|
|
|
CustomFlagsToString(String:buffer[], maxlength, flags)
|
|
|
|
{
|
|
|
|
decl String:joins[6][6];
|
|
|
|
new total;
|
|
|
|
|
|
|
|
for (new i=_:Admin_Custom1; i<=_:Admin_Custom6; i++)
|
|
|
|
{
|
|
|
|
if (flags & (1<<i))
|
|
|
|
{
|
|
|
|
IntToString(i - _:Admin_Custom1 + 1, joins[total++], 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImplodeStrings(joins, total, ",", buffer, maxlength);
|
|
|
|
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
FlagsToString(String:buffer[], maxlength, flags)
|
|
|
|
{
|
2007-08-26 22:04:01 +02:00
|
|
|
decl String:joins[FLAG_STRINGS+1][32];
|
2007-06-08 03:58:26 +02:00
|
|
|
new total;
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
for (new i=0; i<FLAG_STRINGS; i++)
|
|
|
|
{
|
|
|
|
if (flags & (1<<i))
|
|
|
|
{
|
2007-08-26 22:04:01 +02:00
|
|
|
strcopy(joins[total++], 32, g_FlagNames[i]);
|
2007-06-08 03:58:26 +02:00
|
|
|
}
|
|
|
|
}
|
2007-08-26 22:04:01 +02:00
|
|
|
|
|
|
|
decl String:custom_flags[32];
|
|
|
|
if (CustomFlagsToString(custom_flags, sizeof(custom_flags), flags))
|
|
|
|
{
|
|
|
|
Format(joins[total++], 32, "custom(%s)", custom_flags);
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
ImplodeStrings(joins, total, ", ", buffer, maxlength);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Action:Command_Who(client, args)
|
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
/* Display header */
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:t_access[16], String:t_name[16];
|
2007-06-08 03:58:26 +02:00
|
|
|
Format(t_access, sizeof(t_access), "%t", "Access", client);
|
|
|
|
Format(t_name, sizeof(t_name), "%t", "Name", client);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
PrintToConsole(client, "%-24.23s %s", t_name, t_access);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
/* List all players */
|
|
|
|
new maxClients = GetMaxClients();
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:flagstring[255];
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
for (new i=1; i<=maxClients; i++)
|
|
|
|
{
|
|
|
|
if (!IsClientInGame(i))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
new flags = GetUserFlagBits(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);
|
|
|
|
}
|
|
|
|
decl String:name[65];
|
|
|
|
GetClientName(i, name, sizeof(name));
|
|
|
|
PrintToConsole(client, "%d. %-24.23s %s", i, name, flagstring);
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
if (GetCmdReplySource() == SM_REPLY_TO_CHAT)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] %t", "See console for output");
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:arg[65];
|
2007-06-08 03:58:26 +02:00
|
|
|
GetCmdArg(1, arg, sizeof(arg));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
new clients[2];
|
|
|
|
new numClients = SearchForClients(arg, clients, 2);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
if (numClients == 0)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] %t", "No matching client");
|
|
|
|
return Plugin_Handled;
|
|
|
|
} else if (numClients > 1) {
|
|
|
|
ReplyToCommand(client, "[SM] %t", "More than one client matches", arg);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
new flags = GetUserFlagBits(clients[0]);
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:flagstring[255];
|
2007-06-08 03:58:26 +02:00
|
|
|
if (flags == 0)
|
|
|
|
{
|
|
|
|
strcopy(flagstring, sizeof(flagstring), "none");
|
|
|
|
} else if (flags & ADMFLAG_ROOT) {
|
|
|
|
strcopy(flagstring, sizeof(flagstring), "root");
|
|
|
|
} else {
|
|
|
|
FlagsToString(flagstring, sizeof(flagstring), flags);
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
ReplyToCommand(client, "[SM] %t: %s", "Access", flagstring);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:58:26 +02:00
|
|
|
return Plugin_Handled;
|
2007-06-08 03:01:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Action:Command_ExecCfg(client, args)
|
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] Usage: sm_execcfg <filename>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:01:44 +02:00
|
|
|
new String:path[64] = "cfg/";
|
|
|
|
GetCmdArg(1, path[4], sizeof(path)-4);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:01:44 +02:00
|
|
|
if (!FileExists(path))
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] %t", "Config not found", path[4]);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:01:44 +02:00
|
|
|
ShowActivity(client, "%t", "Executed config", path[4]);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-08-27 04:00:37 +02:00
|
|
|
LogAction(client, -1, "\"%L\" executed config (file \"%s\")", client, path[4]);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:01:44 +02:00
|
|
|
ServerCommand("exec \"%s\"", path[4]);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 03:01:44 +02:00
|
|
|
return Plugin_Handled;
|
2007-06-08 01:48:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Action:Command_Cvar(client, args)
|
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] Usage: sm_cvar <cvar> [value]");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:cvarname[33];
|
2007-06-08 01:48:51 +02:00
|
|
|
GetCmdArg(1, cvarname, sizeof(cvarname));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
new Handle:hndl = FindConVar(cvarname);
|
|
|
|
if (hndl == INVALID_HANDLE)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] %t", "Unable to find cvar", cvarname);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
new bool:allowed = false;
|
|
|
|
if (GetConVarFlags(hndl) & FCVAR_PROTECTED)
|
|
|
|
{
|
|
|
|
/* If they're root, allow anything */
|
|
|
|
if ((GetUserFlagBits(client) & ADMFLAG_ROOT) == ADMFLAG_ROOT)
|
|
|
|
{
|
|
|
|
allowed = true;
|
|
|
|
}
|
|
|
|
/* If they're not root, and getting sv_password, see if they have ADMFLAG_PASSWORD */
|
|
|
|
else if (StrEqual(cvarname, "sv_password") && (GetUserFlagBits(client) & ADMFLAG_PASSWORD))
|
|
|
|
{
|
|
|
|
allowed = true;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
}
|
2007-06-08 01:48:51 +02:00
|
|
|
/* Do a check for the cheat cvar */
|
|
|
|
else if (StrEqual(cvarname, "sv_cheats"))
|
|
|
|
{
|
2007-06-08 08:31:46 +02:00
|
|
|
if (GetUserFlagBits(client) & ADMFLAG_CHEATS
|
|
|
|
|| GetUserFlagBits(client) & ADMFLAG_ROOT)
|
2007-06-08 01:48:51 +02:00
|
|
|
{
|
|
|
|
allowed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* If we drop down to here, it was a normal cvar. */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
allowed = true;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
if (!allowed)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] %t", "No access to cvar");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
decl String:value[255];
|
|
|
|
if (args < 2)
|
|
|
|
{
|
|
|
|
GetConVarString(hndl, value, sizeof(value));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
ReplyToCommand(client, "[SM] %t", "Value of cvar", cvarname, value);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
GetCmdArg(2, value, sizeof(value));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
if ((GetConVarFlags(hndl) & FCVAR_PROTECTED) != FCVAR_PROTECTED)
|
|
|
|
{
|
|
|
|
ShowActivity(client, "%t", "Cvar changed", cvarname, value);
|
2007-06-08 05:38:57 +02:00
|
|
|
} else {
|
|
|
|
ReplyToCommand(client, "[SM] %t", "Cvar changed", cvarname, value);
|
2007-06-08 01:48:51 +02:00
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-08-27 04:00:37 +02:00
|
|
|
LogAction(client, -1, "\"%L\" changed cvar (cvar \"%s\") (value \"%s\")", client, cvarname, value);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-15 08:31:12 +02:00
|
|
|
SetConVarString(hndl, value, true);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-08 01:48:51 +02:00
|
|
|
return Plugin_Handled;
|
2007-06-07 23:36:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Action:Command_Rcon(client, args)
|
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] Usage: sm_rcon <args>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:36:24 +02:00
|
|
|
decl String:argstring[255];
|
|
|
|
GetCmdArgString(argstring, sizeof(argstring));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-08-27 04:00:37 +02:00
|
|
|
LogAction(client, -1, "\"%L\" console command (cmdline \"%s\")", client, argstring);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:36:24 +02:00
|
|
|
ServerCommand("%s", argstring);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:36:24 +02:00
|
|
|
return Plugin_Handled;
|
2007-06-07 23:24:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Action:Command_Map(client, args)
|
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] Usage: sm_map <map>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:map[64];
|
2007-06-07 23:24:29 +02:00
|
|
|
GetCmdArg(1, map, sizeof(map));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:24:29 +02:00
|
|
|
if (!IsMapValid(map))
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] %t", "Map was not found", map);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:24:29 +02:00
|
|
|
ShowActivity(client, "%t", "Changing map", map);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-08-27 04:00:37 +02:00
|
|
|
LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:36:24 +02:00
|
|
|
new Handle:dp;
|
2007-06-07 23:24:29 +02:00
|
|
|
CreateDataTimer(3.0, Timer_ChangeMap, dp);
|
|
|
|
WritePackString(dp, map);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:24:29 +02:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
|
|
|
|
{
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:map[65];
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:24:29 +02:00
|
|
|
ResetPack(dp);
|
|
|
|
ReadPackString(dp, map, sizeof(map));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:24:29 +02:00
|
|
|
ServerCommand("changelevel \"%s\"", map);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 23:24:29 +02:00
|
|
|
return Plugin_Stop;
|
2007-06-07 08:17:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Action:Command_Kick(client, args)
|
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] Usage: sm_kick <#userid|name> [reason]");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-30 21:10:46 +02:00
|
|
|
|
|
|
|
decl String:Arguments[256];
|
|
|
|
GetCmdArgString(Arguments, sizeof(Arguments));
|
|
|
|
|
2007-07-15 19:22:47 +02:00
|
|
|
decl String:arg[65];
|
2007-07-30 21:10:46 +02:00
|
|
|
new len = BreakString(Arguments, arg, sizeof(arg));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-28 00:30:05 +02:00
|
|
|
new target = FindTarget(client, arg);
|
|
|
|
if (target == -1)
|
2007-06-07 08:17:57 +02:00
|
|
|
{
|
2007-06-08 05:38:57 +02:00
|
|
|
return Plugin_Handled;
|
2007-06-07 08:17:57 +02:00
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-30 21:10:46 +02:00
|
|
|
GetClientName(target, arg, sizeof(arg));
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-30 21:10:46 +02:00
|
|
|
if (len == -1)
|
2007-06-07 08:17:57 +02:00
|
|
|
{
|
|
|
|
/* Safely null terminate */
|
2007-07-30 21:10:46 +02:00
|
|
|
len = 0;
|
|
|
|
Arguments[0] = '\0';
|
2007-06-07 08:17:57 +02:00
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-07-30 21:10:46 +02:00
|
|
|
ShowActivity(client, "%t", "Kicked player", arg);
|
2007-08-27 04:00:37 +02:00
|
|
|
LogAction(client, target, "\"%L\" kicked \"%L\" (reason \"%s\")", client, target, Arguments[len]);
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-09-13 18:44:50 +02:00
|
|
|
if (Arguments[0] == '\0')
|
|
|
|
{
|
|
|
|
KickClient(target, "%t", "Kicked by admin");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
KickClient(target, "%s", Arguments[len]);
|
|
|
|
}
|
2007-07-29 21:20:42 +02:00
|
|
|
|
2007-06-07 08:17:57 +02:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
2007-08-08 23:32:06 +02:00
|
|
|
|
|
|
|
public Action:Command_CancelVote(client, args)
|
|
|
|
{
|
2007-08-08 23:46:44 +02:00
|
|
|
if (!IsVoteInProgress())
|
2007-08-08 23:32:06 +02:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "[SM] %t", "Vote Not In Progress");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
|
|
|
ShowActivity(client, "%t", "Cancelled Vote");
|
|
|
|
|
|
|
|
CancelVote();
|
|
|
|
|
|
|
|
return Plugin_Handled;
|
2007-09-13 18:44:50 +02:00
|
|
|
}
|