_if_dedicated alias if_client ""
if_client alias if_dedicated ""
-if_client alias cmd_prefix "cmd"
-if_dedicated alias cmd_prefix "sv_cmd"
+if_client set cmd_prefix "cmd"
+if_dedicated set cmd_prefix "sv_cmd"
// ========
alias timein "${cmd_prefix !} timein"
alias timeout "${cmd_prefix !} timeout"
alias vote "${cmd_prefix !} vote ${* ?}"
-alias who "${cmd_prefix !} who"
+alias who "${cmd_prefix !} who ${* ?}"
alias g_hitplots_add "qc_cmd rpn /g_hitplots_individuals g_hitplots_individuals ${1 !} union def"
alias g_hitplots_remove "qc_cmd rpn /g_hitplots_individuals g_hitplots_individuals ${1 !} difference def"
CLIENT_COMMAND("timeout", CommonCommand_timeout(request, self), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \
CLIENT_COMMAND("vote", VoteCommand(request, self, arguments, command), "Request an action to be voted upon by players") \
- CLIENT_COMMAND("who", CommonCommand_who(request, self), "Display detailed client information about all players") \
+ CLIENT_COMMAND("who", CommonCommand_who(request, self, arguments), "Display detailed client information about all players") \
/* nothing */
void ClientCommand_macro_help()
}
}
-void CommonCommand_who(float request, entity caller)
+void CommonCommand_who(float request, entity caller, float argc)
{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
float total_listed_players, tmp_hours, tmp_minutes, tmp_seconds;
- entity tmp_player;
- //string tmp_player_name;
+ entity tmp_player;
- print_to(caller, strcat("List of client information", (autocvar_sv_status_privacy ? " (some data is hidden for privacy)" : string_null), ":"));
- print_to(caller, sprintf(" %-4s %-20s %-5s %-3s %-9s %-16s %s", "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
+ string separator = strcat((argv(1) ? argv(1) : " "), "^7");
+ float privacy = (caller && autocvar_sv_status_privacy);
+
+ print_to(caller, strcat("List of client information", (privacy ? " (some data is hidden for privacy)" : string_null), ":"));
+ print_to(caller, sprintf(strreplace(" ", separator, " %-4s %-20s %-5s %-3s %-9s %-16s %s "),
+ "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
FOR_EACH_CLIENT(tmp_player)
{
if(tmp_minutes) { tmp_seconds -= (tmp_minutes * 60); }
if(tmp_hours) { tmp_minutes -= (tmp_hours * 60); }
- print_to(caller, sprintf(" %-4s %-20s %-5d %-3d %-9s %-16s %s",
+ print_to(caller, sprintf(strreplace(" ", separator, " %-4s %-20.20s %-5d %-3d %-9s %-16s %s "),
strcat("#", ftos(num_for_edict(tmp_player))),
- tmp_player.netname, //strcat(tmp_player_name, sprintf("%*s", (20 - strlen(strdecolorize(tmp_player_name))), "")),
- tmp_player.ping, tmp_player.ping_packetloss,
+ tmp_player.netname,
+ tmp_player.ping,
+ tmp_player.ping_packetloss,
sprintf("%02d:%02d:%02d", tmp_hours, tmp_minutes, tmp_seconds),
- (autocvar_sv_status_privacy ? "hidden" : tmp_player.netaddress),
- (autocvar_sv_status_privacy ? "hidden" : tmp_player.crypto_idfp)));
+ (privacy ? "hidden" : tmp_player.netaddress),
+ (privacy ? "hidden" : tmp_player.crypto_idfp)));
++total_listed_players;
}
default:
case CMD_REQUEST_USAGE:
{
- print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " who"));
- print_to(caller, " No arguments required.");
+ print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " who [separator]"));
+ print_to(caller, " Where 'separator' is the optional string to separate the values with, default is a space.");
return;
}
}
SERVER_COMMAND("trace", GameCommand_trace(request, arguments), "Various debugging tools with tracing") \
SERVER_COMMAND("unlockteams", GameCommand_unlockteams(request), "Enable the ability for players to switch or enter teams") \
SERVER_COMMAND("warp", GameCommand_warp(request, arguments), "Choose different level in campaign") \
- SERVER_COMMAND("who", CommonCommand_who(request, world), "Display detailed client information about all players") \
+ SERVER_COMMAND("who", CommonCommand_who(request, world, arguments), "Display detailed client information about all players") \
SERVER_COMMAND("vote", VoteCommand(request, world, arguments, command), "Server side control of voting") \
/* nothing */