void send_TeamNames(int channel, entity to) {
msg_entity = to;
- LOG_INFOF("Sending team names");
WriteHeader(channel, TE_CSQC_TEAMNAMES);
WriteString(channel, autocvar_g_teamnames_red);
WriteString(channel, autocvar_g_teamnames_blue);
}
}
-void GameCommand_sendteams(int request)
+void GameCommand_team_name(int request, int argc)
{
switch (request)
{
case CMD_REQUEST_COMMAND:
{
+ if (argv(1) == "")
+ {
+ return;
+ }
+ if (!teamplay)
+ {
+ LOG_INFO("selectteam can only be used in teamgames");
+ return;
+ }
+
+ switch (argv(1))
+ {
+ case "red":
+ case "blue":
+ case "yellow":
+ case "pink":
+ {
+ if(argv(2) != "") {
+ cvar_set(strcat("g_teamnames_", argv(1)), argv(2));
+ int tm = Team_ColorToTeam(argv(1));
+ bprintf("\{1}%s%s^7 team is now known as %s^7\n", Team_ColorCode(tm), Team_ColorName(tm), argv(2));
+ } else {
+ cvar_set(strcat("g_teamnames_", argv(1)), "");
+ bprintf("\{1}%s%s^7 team now doesn't have a team name\n", Team_ColorCode(tm), Team_ColorName(tm), argv(2));
+ }
+
+ break;
+ }
+ default:
+ {
+ return;
+ }
+ }
+
send_TeamNames(MSG_BROADCAST, NULL);
return;
}
default:
+ LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
case CMD_REQUEST_USAGE:
{
LOG_HELP("Usage:^3 sv_cmd sendteams");
}
}
}
+
void GameCommand_allready(int request)
{
switch (request)
// ==================================
// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
+SERVER_COMMAND(team_name, "Set team name") { GameCommand_team_name(request, arguments); }
+
SERVER_COMMAND(adminmsg, "Send an admin message to a client directly") { GameCommand_adminmsg(request, arguments); }
-SERVER_COMMAND(sendteams, "Send team names") { GameCommand_sendteams(request); }
SERVER_COMMAND(allready, "Restart the server and reset the players") { GameCommand_allready(request); }
SERVER_COMMAND(allspec, "Force all players to spectate") { GameCommand_allspec(request, arguments); }
SERVER_COMMAND(anticheat, "Create an anticheat report for a client") { GameCommand_anticheat(request, arguments); }
// add up all the votes from each connected client
FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), {
+ // z411
+ if(vote_target_type == VOTE_TARGET_TEAM && it.team != vote_caller.team) continue;
+ if(vote_target_type == VOTE_TARGET_SINGLE && it != vote_target) continue;
+
++vote_player_count;
if (IS_PLAYER(it)) ++vote_real_player_count;
switch (it.vote_selection)
case MUT_VOTEPARSE_UNACCEPTABLE: { return 0; }
}
+ vote_target_type = VOTE_TARGET_ALL;
+
switch (first_command) // now go through and parse the proper commands to adjust as needed.
{
case "kick":
if (first_command == "kickban")
command_arguments = strcat(ftos(autocvar_g_ban_default_bantime), " ", ftos(autocvar_g_ban_default_masksize), " ~");
- vote_parsed_command = strcat(first_command, " # ", ftos(etof(victim)), " ", command_arguments);
+ 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; }
{
vote_command = ValidateMap(argv(startpos + 1), caller);
if (!vote_command) return -1;
- vote_parsed_command = strcat("gotomap ", vote_command);
+ vote_parsed_command = strcat("defer 2 gotomap ", vote_command);
vote_parsed_display = strzone(strcat("^1", vote_parsed_command));
break;
}
+
+ // z411 team calls
+ case "team_name":
+ {
+ if (teamplay && Team_IsValidTeam(caller.team)) {
+ vote_target_type = VOTE_TARGET_TEAM;
+
+ string tmname = strtolower(Static_Team_ColorName(caller.team));
+ string newname = argv(startpos + 1);
+
+ vote_parsed_command = strcat(first_command, " ", tmname, " \"", newname, "\"");
+ vote_parsed_display = strzone(strcat("^3(Team) ^1", first_command, " ^2", newname));
+ } else { print_to(caller, "vcall: Not in a team\n"); return 0; }
+
+ break;
+ }
// TODO: replicate the old behaviour of being able to vote for maps from different modes on multimode servers (possibly support it in gotomap too)
// maybe fallback instead of aborting if map name is invalid?
}
case "restart":
+ case "shuffleteams":
+ case "endmatch":
{
// add a delay so that vote result can be seen and announcer can be heard
// if the vote is accepted
- vote_parsed_command = strcat("defer 1 ", vote_command);
+ vote_parsed_command = strcat("defer 2 ", vote_command);
vote_parsed_display = strzone(strcat("^1", vote_command));
break;
const float VOTE_NORMAL = 1;
const float VOTE_MASTER = 2;
+// z411 vote targets
+const float VOTE_TARGET_ALL = 0;
+const float VOTE_TARGET_TEAM = 1;
+const float VOTE_TARGET_SINGLE = 2;
+
// global vote information declarations
entity vote_caller; // original caller of the current vote
string vote_caller_name; // name of the vote caller
float vote_reject_count; // same as above, but rejected
float vote_abstain_count; // same as above, but abstained
float vote_needed_overall; // total amount of players NEEDED for a vote to pass (based on sv_vote_majority_factor)
+float vote_target_type; // z411
+entity vote_target; // z411
.float vote_master; // flag for if the player has vote master privelages
.float vote_waittime; // flag for how long the player must wait before they can vote again
.float vote_selection; // flag for which vote selection the player has made (See VOTE_SELECT_*)