}
}
+void BanCommand_kickkick(int request, int argc, string command)
+{
+ switch (request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ if (argc >= 2)
+ {
+ entity client = GetIndexedEntity(argc, 1);
+ float accepted = VerifyKickableEntity(client);
+ float reason_arg;
+ string reason;
+
+ if (accepted > 0)
+ {
+ reason_arg = next_token;
+
+ GET_BAN_REASON(reason, "No reason provided");
+
+ Ban_KickClient(client, reason);
+
+ return;
+ }
+ else
+ {
+ LOG_INFO("kick: ", GetClientErrorString(accepted, argv(1)), ".");
+ }
+ }
+ }
+
+ default:
+ LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
+ case CMD_REQUEST_USAGE:
+ {
+ LOG_HELP("Usage:^3 sv_cmd kickkick <client> [<reason>]");
+ LOG_HELP(" <client> is the entity number or name of the player to kick,");
+ LOG_HELP(" and <reason> is the string to label the ban with as reason for kicking.");
+ LOG_HELP("See also: ^2kick^7");
+ return;
+ }
+ }
+}
+
void BanCommand_kickban(int request, int argc, string command)
{
switch (request)
#define BAN_COMMANDS(request, arguments, command) \
BAN_COMMAND("ban", BanCommand_ban(request, arguments, command), "Ban an IP address or a range of addresses (like 1.2.3)") \
BAN_COMMAND("banlist", BanCommand_banlist(request), "List all existing bans") \
+ BAN_COMMAND("kickkick", BanCommand_kickkick(request, arguments, command), "Disconnect a client") \
BAN_COMMAND("kickban", BanCommand_kickban(request, arguments, command), "Disconnect a client and ban it at the same time") \
BAN_COMMAND("mute", BanCommand_mute(request, arguments, command), "Disallow a client from talking by muting them") \
BAN_COMMAND("unban", BanCommand_unban(request, arguments), "Remove an existing ban") \
if (first_command == "kickban")
command_arguments = strcat(ftos(autocvar_g_ban_default_bantime), " ", ftos(autocvar_g_ban_default_masksize), " ~");
- vote_parsed_command = strcat("defer 2 \"", first_command, " # ", ftos(etof(victim)), " ", command_arguments, "\"");
+ if (first_command == "kick") // z411 : Use our kick implementation - kind of hacky...
+ vote_parsed_command = strcat("defer 2 \"sv_cmd kickkick # ", ftos(etof(victim)), " ", command_arguments, "\"");
+ else
+ vote_parsed_command = strcat("defer 2 \"", first_command, " # ", ftos(etof(victim)), " ", command_arguments, "\"");
+
vote_parsed_display = sprintf("^1%s #%d ^7%s^1 %s", first_command, etof(victim), victim.netname, reason);
}
else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return 0; }
return true;
}
+void Ban_KickClient(entity client, string reason)
+{
+ sprint(client, strcat("Kicked: ", reason, "\n"));
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK, client.netname);
+ dropclient(client);
+}
+
void Ban_KickBanClient(entity client, float bantime, float masksize, string reason)
{
string ip, id;
if(!Ban_GetClientIP(client))
{
sprint(client, strcat("Kickbanned: ", reason, "\n"));
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK, client.netname);
dropclient(client);
return;
}