X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fcommand%2Fbanning.qc;h=42de51882e81d8f6f39d2d1585875028604ea3db;hb=90d9f7c775306324957323d53d5a4ad995d999e3;hp=fa1be75112914be996dde63c5499328c79bab773;hpb=a234fc2b3af24de2c434431ff6653e7721a804e1;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/banning.qc b/qcsrc/server/command/banning.qc index fa1be7511..42de51882 100644 --- a/qcsrc/server/command/banning.qc +++ b/qcsrc/server/command/banning.qc @@ -1,4 +1,7 @@ #include "banning.qh" + +#include +#include #include #include #include "banning.qh" @@ -15,7 +18,7 @@ // Last updated: December 29th, 2011 // ===================================================== -void BanCommand_ban(float request, float argc, string command) +void BanCommand_ban(int request, int argc, string command) { switch (request) { @@ -38,20 +41,20 @@ void BanCommand_ban(float request, float argc, string command) } default: - LOG_INFO("Incorrect parameters for ^2ban^7\n"); + LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0)); case CMD_REQUEST_USAGE: { - LOG_INFO("\nUsage:^3 sv_cmd ban address [bantime] [reason]\n"); - LOG_INFO(" 'address' is the IP address or range of the player to ban,\n"); - LOG_INFO(" 'bantime' is the amount of time that the ban is active (default if not provided),\n"); - LOG_INFO(" and 'reason' is the string to label the ban with as reason for banning.\n"); - LOG_INFO("See also: ^2banlist, kickban, unban^7\n"); + LOG_HELP("Usage:^3 sv_cmd ban address [bantime] [reason]"); + LOG_HELP(" 'address' is the IP address or range of the player to ban,"); + LOG_HELP(" 'bantime' is the amount of time that the ban is active (default if not provided),"); + LOG_HELP(" and 'reason' is the string to label the ban with as reason for banning."); + LOG_HELP("See also: ^2banlist, kickban, unban^7"); return; } } } -void BanCommand_banlist(float request) +void BanCommand_banlist(int request) { switch (request) { @@ -64,15 +67,15 @@ void BanCommand_banlist(float request) default: case CMD_REQUEST_USAGE: { - LOG_INFO("\nUsage:^3 sv_cmd banlist\n"); - LOG_INFO(" No arguments required.\n"); - LOG_INFO("See also: ^2ban, kickban, unban^7\n"); + LOG_HELP("Usage:^3 sv_cmd banlist"); + LOG_HELP(" No arguments required."); + LOG_HELP("See also: ^2ban, kickban, unban^7"); return; } } } -void BanCommand_kickban(float request, float argc, string command) +void BanCommand_kickban(int request, int argc, string command) { switch (request) { @@ -99,27 +102,27 @@ void BanCommand_kickban(float request, float argc, string command) } else { - LOG_INFO("kickban: ", GetClientErrorString(accepted, argv(1)), ".\n"); + LOG_INFO("kickban: ", GetClientErrorString(accepted, argv(1)), "."); } } } default: - LOG_INFO("Incorrect parameters for ^2kickban^7\n"); + LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0)); case CMD_REQUEST_USAGE: { - LOG_INFO("\nUsage:^3 sv_cmd kickban client [bantime] [masksize] [reason]\n"); - LOG_INFO(" 'client' is the entity number or name of the player to ban,\n"); - LOG_INFO(" 'bantime' is the amount of time that the ban is active (default if not provided),\n"); - LOG_INFO(" 'masksize' is the range of the IP address (1-thru-4, default if not provided),\n"); - LOG_INFO(" and 'reason' is the string to label the ban with as reason for banning.\n"); - LOG_INFO("See also: ^2ban, banlist, unban^7\n"); + LOG_HELP("Usage:^3 sv_cmd kickban client [bantime] [masksize] [reason]"); + LOG_HELP(" 'client' is the entity number or name of the player to ban,"); + LOG_HELP(" 'bantime' is the amount of time that the ban is active (default if not provided),"); + LOG_HELP(" 'masksize' is the range of the IP address (1-thru-4, default if not provided),"); + LOG_HELP(" and 'reason' is the string to label the ban with as reason for banning."); + LOG_HELP("See also: ^2ban, banlist, unban^7"); return; } } } -void BanCommand_mute(float request, float argc, string command) // TODO: Add a sort of mute-"ban" which allows players to be muted based on IP/cryptokey +void BanCommand_mute(int request, int argc, string command) // TODO: Add a sort of mute-"ban" which allows players to be muted based on IP/cryptokey { switch (request) { @@ -137,24 +140,24 @@ void BanCommand_mute(float request, float argc, string command) // TODO: Add a } else { - LOG_INFO("mute: ", GetClientErrorString(accepted, argv(1)), ".\n"); + LOG_INFO("mute: ", GetClientErrorString(accepted, argv(1)), "."); } } } default: - LOG_INFO("Incorrect parameters for ^2mute^7\n"); + LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0)); case CMD_REQUEST_USAGE: { - LOG_INFO("\nUsage:^3 sv_cmd mute client\n"); - LOG_INFO(" 'client' is the entity number or name of the player to mute.\n"); - LOG_INFO("See also: ^2unmute^7\n"); + LOG_HELP("Usage:^3 sv_cmd mute client"); + LOG_HELP(" 'client' is the entity number or name of the player to mute."); + LOG_HELP("See also: ^2unmute^7"); return; } } } -void BanCommand_unban(float request, float argc) +void BanCommand_unban(int request, int argc) { switch (request) { @@ -192,15 +195,15 @@ void BanCommand_unban(float request, float argc) default: case CMD_REQUEST_USAGE: { - LOG_INFO("\nUsage:^3 sv_cmd unban banid\n"); - LOG_INFO(" Where 'banid' is the ID of the ban of which to remove.\n"); - LOG_INFO("See also: ^2ban, banlist, kickban^7\n"); + LOG_HELP("Usage:^3 sv_cmd unban banid"); + LOG_HELP(" Where 'banid' is the ID of the ban of which to remove."); + LOG_HELP("See also: ^2ban, banlist, kickban^7"); return; } } } -void BanCommand_unmute(float request, float argc) +void BanCommand_unmute(int request, int argc) { switch (request) { @@ -218,18 +221,18 @@ void BanCommand_unmute(float request, float argc) } else { - LOG_INFO("unmute: ", GetClientErrorString(accepted, argv(1)), ".\n"); + LOG_INFO("unmute: ", GetClientErrorString(accepted, argv(1)), "."); } } } default: - LOG_INFO("Incorrect parameters for ^2mute^7\n"); + LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0)); case CMD_REQUEST_USAGE: { - LOG_INFO("\nUsage:^3 sv_cmd unmute client\n"); - LOG_INFO(" 'client' is the entity number or name of the player to unmute.\n"); - LOG_INFO("See also: ^2mute^7\n"); + LOG_HELP("Usage:^3 sv_cmd unmute client"); + LOG_HELP(" 'client' is the entity number or name of the player to unmute."); + LOG_HELP("See also: ^2mute^7"); return; } } @@ -237,7 +240,7 @@ void BanCommand_unmute(float request, float argc) /* use this when creating a new command, making sure to place it in alphabetical order... also, ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION! -void BanCommand_(float request) +void BanCommand_(int request) { switch(request) { @@ -250,8 +253,8 @@ void BanCommand_(float request) default: case CMD_REQUEST_USAGE: { - print("\nUsage:^3 sv_cmd \n"); - print(" No arguments required.\n"); + LOG_HELP("Usage:^3 sv_cmd "); + LOG_HELP(" No arguments required."); return; } } @@ -276,13 +279,13 @@ void BanCommand_(float request) void BanCommand_macro_help() { #define BAN_COMMAND(name, function, description) \ - { if (strtolower(description) != "") { LOG_INFO(" ^2", name, "^7: ", description, "\n"); } } + { if (strtolower(description) != "") { LOG_INFO(" ^2", name, "^7: ", description); } } BAN_COMMANDS(0, 0, ""); #undef BAN_COMMAND } -float BanCommand_macro_command(float argc, string command) +float BanCommand_macro_command(int argc, string command) { #define BAN_COMMAND(name, function, description) \ { if (name == strtolower(argv(0))) { function; return true; } } @@ -293,7 +296,7 @@ float BanCommand_macro_command(float argc, string command) return false; } -float BanCommand_macro_usage(float argc) +float BanCommand_macro_usage(int argc) { #define BAN_COMMAND(name, function, description) \ { if (name == strtolower(argv(1))) { function; return true; } } @@ -315,7 +318,7 @@ void BanCommand_macro_write_aliases(float fh) float BanCommand(string command) { - float argc = tokenize_console(command); + int argc = tokenize_console(command); // Guide for working with argc arguments by example: // argc: 1 - 2 - 3 - 4