57 if (!to.ready) nags |=
BIT(1);
65 if (to.vote_selection == 0) nags |=
BIT(3);
66 nags |= sendflags &
BIT(6);
67 nags |= sendflags &
BIT(7);
87 for (
int b = 0; b < 8 && i <=
maxclients; ++b, ++i)
88 if (edict_num(i).
ready)
203 ((mincount >= 0) ?
strcat(
"^2 (^1",
ftos(mincount),
"^2 needed)") :
"^2"),
205 strcat(
", ^1",
ftos(notvoters),
strcat(
"^2 didn't ", ((mincount >= 0) ?
"" :
"have to "),
"vote\n"))));
218#define spectators_allowed (!autocvar_sv_vote_nospectators || (autocvar_sv_vote_nospectators == 1 && (warmup_stage || intermission_running)))
224 float vote_player_count = 0, notvoters = 0;
225 float vote_real_player_count = 0, vote_real_accept_count = 0;
226 float vote_real_reject_count = 0, vote_real_abstain_count = 0;
227 float vote_needed_of_voted, final_needed_votes;
228 float vote_factor_overall, vote_factor_of_voted;
236 switch (it.vote_selection)
258 print_to(
vote_caller,
"^1There are not enough players on this server to allow you to become vote master.");
269 vote_player_count = vote_real_player_count;
284 if (vote_player_count == 0 && first_count)
331 VoteSpam(notvoters, final_needed_votes,
"timeout");
358 if (!is_fake_round_start)
399 if (it.team_saved) it.team = it.team_saved;
405 if (it.reset2) it.reset2(it);
415 CS(it).killcount = 0;
417 it.velocity =
'0 0 0';
418 it.avelocity =
'0 0 0';
419 CS(it).movement =
'0 0 0';
425 if(it.(weaponentity).m_weapon == WEP_Null)
464 it.alivetime_start = 0;
465 CS(it).killcount = 0;
532 error(
"ReadyRestart must be supported in campaign mode!");
538 localcmd(
"\nsv_hook_readyrestart\n");
567 if (it.ready) ++humans_ready;
614 if (humans_ready && humans_ready >=
rint(human_players *
bound(0.5,
cvar(
"g_warmup_majority_factor"), 1)))
625 bool from_server = (!caller);
638 if ((argc - 1) < startpos) output =
"";
646 return !((
strstrofs(vote_command,
";", 0) >= 0)
647 || (
strstrofs(vote_command,
"\n", 0) >= 0)
648 || (
strstrofs(vote_command,
"\r", 0) >= 0)
649 || (
strstrofs(vote_command,
"$", 0) >= 0));
656 string output =
strcat(
" ", input,
" ");
658 output = strreplace(
" map ",
" gotomap ", output);
659 output = strreplace(
" chmap ",
" gotomap ", output);
665 if (vote_command ==
"" || list ==
"")
678 print_to(caller,
"This map is not available on this server.");
686 print_to(caller,
"This server does not allow for recent maps to be played again. Please be patient for some rounds.");
693 print_to(caller,
strcat(
"^1Invalid mapname, \"^3", validated_map,
"^1\" does not support the current gametype."));
697 return validated_map;
702 float p, q, check, minargs;
703 string cvarname =
strcat(
"sv_vote_command_restriction_",
argv(startpos));
704 string cmdrestriction =
"";
705 string charlist, arg;
711 LOG_INFO(
"NOTE: ", cvarname,
" does not exist, no restrictions will be applied.");
713 if (cmdrestriction ==
"")
return true;
723 minargs =
stof(cmdrestriction);
724 if (argc - startpos < minargs)
return false;
735 if (startpos >= argc)
741 if (argc - startpos == minargs)
break;
748 q =
strstrofs(cmdrestriction,
";", p + 1);
749 if (q < 0) charlist =
substring(cmdrestriction, p + 1, -1);
750 else charlist =
substring(cmdrestriction, p + 1, q - (p + 1));
758 arg =
argv(startpos);
760 for (check = 0; check < checkmate; ++check)
776 string first_command =
argv(startpos);
786 switch (
MUTATOR_CALLHOOK(VoteCommand_Parse, caller, first_command, vote_command, startpos, argc))
794 switch (first_command)
827 string reason =
"No reason provided";
831 string command_arguments = reason;
832 if (first_command ==
"kickban")
852 if (!vote_command)
return -1;
864 if (!vote_command)
return -1;
873 float fraglimit_vote =
stof(
argv(startpos + 1));
874 float fraglimit_min = 0;
875 float fraglimit_max = 999999;
876 if(fraglimit_vote > fraglimit_max || fraglimit_vote < fraglimit_min)
878 print_to(caller,
strcat(
"Invalid fraglimit vote, accepted values are between ",
ftos(fraglimit_min),
" and ",
ftos(fraglimit_max),
"."));
889 float timelimit_vote =
stof(
argv(startpos + 1));
914 print_to(caller,
"Game already started. Use the resetmatch command to restart the match.");
948 print_to(caller,
"^1You are banned from voting.");
956 print_to(caller,
"^1You have already voted.");
961 print_to(caller,
"^1You abstained from your vote.");
975 print_to(caller,
" No arguments required.");
992 float tmp_playercount = 0;
997 print_to(caller,
"^1You are banned from calling a vote.");
1006 print_to(caller,
"^1Vote calling is not allowed.");
1010 print_to(caller,
"^1Vote calling is not allowed before the match has started.");
1014 print_to(caller,
"^1There is already a vote called.");
1018 print_to(caller,
"^1Only players can call a vote.");
1022 print_to(caller,
"^1Only connected clients can vote.");
1026 print_to(caller,
"^1You can not call a vote while a timeout is active.");
1028 else if (caller && (
time < caller.vote_waittime))
1030 print_to(caller,
strcat(
"^1You have to wait ^2",
ftos(
ceil(caller.vote_waittime -
time)),
"^1 seconds before you can again call a vote."));
1034 print_to(caller,
"^1Syntax error in command.");
1038 if(parse_error == 0)
1043 print_to(caller,
"^1This command is not acceptable or not available.");
1066 bprint(
"\{1}^2* ^3",
"^6DEBUG MODE ACTIVE: bots can vote too\n");
1083 print_to(caller,
" Where <command> is the command to request a vote upon.");
1087 print_to(caller,
"Shortcuts: ^2vcall <command>, vend, vmap, vkick, ...");
1108 if (!caller.vote_master)
1109 print_to(caller,
"^1You do not have vote master privileges.");
1112 print_to(caller,
"^1Syntax error in command.");
1116 if(parse_error == 0)
1121 print_to(caller,
"^1This command is not acceptable or not available.");
1139 else if (caller.vote_master)
1141 print_to(caller,
"^1You are already logged in as vote master.");
1149 caller.vote_master =
true;
1164 print_to(caller,
"^1There is already a vote called.");
1168 print_to(caller,
"^1Only players can call a vote.");
1172 print_to(caller,
"^1You can not call a vote while a timeout is active.");
1197 else {
print_to(caller,
"^1Master control of voting is not allowed."); }
1206 print_to(caller,
" If <action> is left blank, it calls a vote for you to become master.");
1207 print_to(caller,
" Otherwise it can be either 'do' (to run <command>) or 'login' as master.");
1221 print_to(caller,
"^1You are banned from voting.");
1229 print_to(caller,
"^1You have already voted.");
1238 print_to(caller,
"^1You rejected the vote.");
1252 print_to(caller,
" No arguments required.");
1265 else print_to(caller,
"^1No vote called.");
1274 print_to(caller,
" No arguments required.");
1287 else if ((caller ==
vote_caller) || !caller || caller.vote_master)
VoteStop(caller,
false);
1288 else print_to(caller,
"^1You are not allowed to stop that vote.");
1296 print_to(caller,
" No arguments required.");
1310 print_to(caller,
"^1You are banned from voting.");
1318 print_to(caller,
"^1You have already voted.");
1322 print_to(caller,
"^1You accepted the vote.");
1336 print_to(caller,
" No arguments required.");
1371#define VOTE_COMMANDS(request, caller, arguments, command) \
1372 VOTE_COMMAND("abstain", VoteCommand_abstain(request, caller), "Abstain your vote in current vote", VC_ASGNMNT_CLIENTONLY) \
1373 VOTE_COMMAND("call", VoteCommand_call(request, caller, arguments, command), "Create a new vote for players to decide on", VC_ASGNMNT_BOTH) \
1374 VOTE_COMMAND("help", VoteCommand_macro_help(caller, arguments), "Shows this information", VC_ASGNMNT_BOTH) \
1375 VOTE_COMMAND("master", VoteCommand_master(request, caller, arguments, command), "Full control over all voting and vote commands", VC_ASGNMNT_CLIENTONLY) \
1376 VOTE_COMMAND("no", VoteCommand_no(request, caller), "Select no in current vote", VC_ASGNMNT_CLIENTONLY) \
1377 VOTE_COMMAND("status", VoteCommand_status(request, caller), "Prints information about current vote", VC_ASGNMNT_BOTH) \
1378 VOTE_COMMAND("stop", VoteCommand_stop(request, caller), "Immediately end a vote", VC_ASGNMNT_BOTH) \
1379 VOTE_COMMAND("yes", VoteCommand_yes(request, caller), "Select yes in current vote", VC_ASGNMNT_CLIENTONLY) \
1386 if (argc == 2 ||
argv(2) ==
"help")
1388 print_to(caller,
"\nVoting commands:\n");
1389 #define VOTE_COMMAND(name, function, description, assignment) \
1390 { if (Votecommand_check_assignment(caller, assignment)) { print_to(caller, strcat(" ^2", name, "^7: ", description)); } }
1395 print_to(caller,
strcat(
"\nUsage:^3 ", command_origin,
" vote <command>^7, where possible commands are listed above.\n"));
1396 print_to(caller,
strcat(
"For help about a specific command, type ", command_origin,
" vote help <command>"));
1401 #define VOTE_COMMAND(name, function, description, assignment) \
1402 { if (Votecommand_check_assignment(caller, assignment)) { if (name == strtolower(argv(2))) { function; return; } } }
1407 string cvarname =
strcat(
"sv_vote_command_help_",
argv(2));
1410 else if (
argv(2) !=
"")
1411 print_to(caller,
"No documentation exists for this vote");
1417 #define VOTE_COMMAND(name, function, description, assignment) \
1418 { if (Votecommand_check_assignment(caller, assignment)) { if (name == strtolower(argv(1))) { function; return true; } } }
void accuracy_reset(entity e)
string autocvar_g_voteban_list
float autocvar_g_ban_default_bantime
float autocvar_g_ban_default_masksize
#define MUTATOR_CALLHOOK(id,...)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
const int CMD_REQUEST_COMMAND
const int CMD_REQUEST_USAGE
#define IS_NOT_A_CLIENT(s)
#define autocvar_timelimit
string playername(string thename, int teamid, bool team_colorize)
void wordwrap_sprint(entity to, string s, float l)
string strtolower(string s)
float CVAR_TYPEFLAG_EXISTS
void GameLogEcho(string s)
bool autocvar_sv_eventlog
bool Map_IsRecent(string m)
bool intermission_running
void Inventory_update(entity e)
void Inventory_clear(entity store)
#define FOREACH_ENTITY_ORDERED(cond, body)
#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body)
#define PutClientInServer
#define WriteHeader(to, id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
float MapInfo_CheckMap(string s)
string MapInfo_FixName(string s)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
#define TRANSMUTE(cname, this,...)
#define new_pure(class)
purely logical entities (not linked to the area grid)
void PlayerStats_GameReport_Reset_All()
void round_handler_Reset(float next_think)
#define round_handler_IsActive()
void Score_ClearAll()
Clear ALL scores (for ready-restart).
void W_NextWeapon(entity this, int list,.entity weaponentity)
void player_powerups_remove_all(entity this, bool allow_poweroff_sound)
void GiveWarmupResources(entity this)
bool PlayerInList(entity player, string list)
void Join(entity this, bool queued_join)
it's assumed this isn't called for bots (campaign_bots_may_start, centreprints)
void ClientData_Touch(entity e, bool to_spectators_too)
bool autocvar_sv_teamnagger
bool autocvar_sv_spectate
void print_to(entity to, string input)
string GetCommandPrefix(entity caller)
entity GetIndexedEntity(int argc, int start_index)
int VerifyClientEntity(entity client, bool must_be_real, bool must_be_bots)
string GetCallerName(entity caller)
#define GetClientErrorString(clienterror, original_input)
int autocvar_sv_timeout_number
#define spectators_allowed
float VoteCommand_checkargs(float startpos, int argc)
void VoteCommand_call(int request, entity caller, int argc, string vote_command)
string OriginalCallerName()
void VoteCommand_yes(int request, entity caller)
void print_available_commands_to(entity caller)
void reset_map(bool is_fake_round_start)
string ValidateMap(string validated_map, entity caller)
#define VOTE_COMMANDS(request, caller, arguments, command)
bool Votecommand_check_assignment(entity caller, float assignment)
float VoteCommand_macro_command(entity caller, int argc, string vote_command)
void VoteCount(float first_count)
string VoteCommand_checkreplacements(string input)
void Nagger_VoteCountChanged()
void ReadyRestart(bool forceWarmupEnd)
void Nagger_ReadyCounted()
void VoteCommand_no(int request, entity caller)
void VoteSpam(float notvoters, float mincount, string result)
void VoteReset(bool verbose)
void VoteCommand(int request, entity caller, int argc, string vote_command)
void VoteCommand_abstain(int request, entity caller)
void Nagger_VoteChanged()
string VoteCommand_extractcommand(string input, float startpos, int argc)
bool VoteCommand_checkinlist(string vote_command, string list)
void VoteStop(entity stopper, bool show_name)
void VoteCommand_macro_help(entity caller, int argc)
void ReadyRestart_think(entity this)
void VoteCommand_master(int request, entity caller, int argc, string vote_command)
void VoteCommand_stop(int request, entity caller)
int VoteCommand_parse(entity caller, string vote_command, string vote_list, float startpos, int argc)
bool Nagger_SendEntity(entity this, entity to, float sendflags)
void VoteCommand_status(int request, entity caller)
bool VoteCommand_checknasty(string vote_command)
void ReadyRestart_force(bool is_fake_round_start)
string vote_called_command
string vote_parsed_display
bool autocvar_sv_vote_master_callable
bool autocvar_sv_vote_no_stops_vote
const float VC_ASGNMNT_BOTH
const float RESTART_COUNTDOWN
int autocvar_sv_vote_limit
bool autocvar_sv_vote_change
const float VOTE_SELECT_REJECT
bool autocvar_sv_vote_master
bool autocvar_sv_vote_call
const float VC_ASGNMNT_CLIENTONLY
string vote_parsed_command
string autocvar_sv_vote_commands
string vote_called_display
string autocvar_sv_vote_master_commands
float autocvar_sv_vote_majority_factor_of_voted
bool autocvar_sv_vote_debug
string autocvar_sv_vote_master_password
const float VOTE_SELECT_ACCEPT
const float VOTE_SELECT_NULL
float autocvar_sv_vote_stop
float autocvar_sv_vote_timeout
const float VC_ASGNMNT_SERVERONLY
int autocvar_sv_vote_master_playerlimit
float autocvar_sv_vote_wait
const float VOTE_SELECT_ABSTAIN
bool autocvar_sv_vote_singlecount
bool autocvar_sv_vote_override_mostrecent
float autocvar_sv_vote_majority_factor
bool autocvar_sv_vote_gamestart
@ MUT_VOTEPARSE_UNACCEPTABLE
ClientState CS(Client this)
bool shuffleteams_on_reset_map
#define INGAME_JOINED(it)
int TeamBalance_SizeDifference(entity ignore)
Returns the size difference between the largest and smallest team (bots included).
bool autocvar_teamplay_lockonrestart
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
entity weaponentities[MAX_WEAPONSLOTS]
float autocvar_timelimit_max
float checkrules_suddendeathwarning
float autocvar_timelimit_min
int checkrules_overtimesadded
float checkrules_suddendeathend
float autocvar_timelimit_overtime
bool sv_ready_restart_after_countdown