23 strcat(
"sv_vote_gametype_", type_name,
"_type")),
false,
false);
35 strcat(
"sv_vote_gametype_", type_name,
"_type")),
false,
false);
54 vector gametype_mask =
'0 0 0';
57 for (
int i = 0; i < n; ++i)
60 if (gametype_mask ==
'0 0 0')
94 return "That's not how to use this command.";
96 return "Suggestions are not accepted on this server.";
98 return "Can't suggest, voting is already in progress.";
101 return "The map you suggested is not available on this server.";
103 return "This server does not allow for recent maps to be played again. Please be patient for some rounds.";
106 return "The map you suggested does not support the current gametype.";
110 return "This map was already suggested.";
126 return strcat(
"Suggestion of ", m,
" accepted.");
131 string next_map =
"";
134 else if (from_i == -2)
135 next_map =
"don't care";
141 string suggester = (from_i >= 0 ?
mv_suggester[from_i] :
"");
157 pakfile = whichpack(
strcat(mapfile,
".tga"));
159 pakfile = whichpack(
strcat(mapfile,
".jpg"));
161 pakfile = whichpack(
strcat(mapfile,
".png"));
175 if (suggester !=
"" && from_i !=
mv_count)
191 int max_attempts = (available_maps < 2)
193 :
min(available_maps * 5, 100);
219 for (i =
mv_count; i <= last_i; ++i)
225 for (
int att = 0; att < max_attempts &&
mv_count < nmax; ++att)
344 TC(
int, i);
TC(
int, j);
351 TC(
int, i);
TC(
int, j);
356 if (avail_j && !avail_i)
358 if (avail_i && !avail_j)
360 if (!avail_i && !avail_j)
369 if (votes_i == votes_j)
371 return votes_j - votes_i;
390 idx = it.mapvote - 1;
419 int votes_running_total = votes_recent;
422 || (mv_voters_real - votes_running_total) < votes_recent
423 || mv_voters_real == 0)
430#define REDUCE_REMOVE_THIS(idx) (keep_exactly \
431 ? (idx >= mv_reduce_count) \
432 : (mv_votes[mv_ranked[idx]] <= 0))
439 votes_running_total += votes_recent;
444 || (mv_voters_real - votes_running_total) < votes_recent)
448 string result =
":vote:reduce";
469#undef REDUCE_REMOVE_THIS
555 localcmd(
"\nfs_rescan\nrescan_pending 3\n");
592 if (gametype_string ==
"")
601 localcmd(
"\nsv_vote_gametype_hook_all\n");
602 localcmd(
"\nsv_vote_gametype_hook_", gametype_string,
"\n");
626 bprint(
"Cannot use this gametype: no map for it found\n");
633 string gvmaplist =
strcat(
"sv_vote_gametype_", gametype_string,
"_maplist");
700 int really_available = 0;
701 int which_available = -1;
703 for (i = 0; i < n; ++i)
719 if (really_available == 0)
729 if (really_available == 1)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
float CVAR_TYPEFLAG_EXISTS
#define tokenizebyseparator
#define pass(name, colormin, colormax)
WriteString(chan, ent.netname)
WriteByte(chan, ent.angles.y/DEC_FACTOR)
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
void GameLogEcho(string s)
bool autocvar_sv_eventlog
void Map_Goto_SetStr(string nextmapname)
bool Map_IsRecent(string m)
void Map_Goto(float reinit)
float DoNextMapOverride(float reinit)
void GotoNextMap(float reinit)
float MapInfo_CheckMap(string s)
float MapInfo_FilterGametype(Gametype pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
int MapInfo_RequiredFlags()
string MapInfo_Type_ToString(Gametype t)
float _MapInfo_FilterGametype(vector pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
Gametype MapInfo_CurrentGametype()
int MapInfo_Get_ByName(string pFilename, float pAllowGenerate, Gametype pGametypeToSet)
int MapInfo_ForbiddenFlags()
int MapInfo_CurrentFeatures()
string MapInfo_ListAllowedMaps(Gametype type, float pRequiredFlags, float pForbiddenFlags)
void MapInfo_SwitchGameType(Gametype t)
Gametype MapInfo_Type_FromString(string gtype, bool dowarn, bool is_q3compat)
string MapInfo_FixName(string s)
vector MapInfo_Map_supportedGametypes
void MapVote_ReadPlayerVote(entity voter)
void MapVote_Winner(int mappos)
bool mv_abstain
(shared) if abstaining is possible, false in gametype voting
int mv_count
(shared) number of maps/gametypes
const int GTV_CUSTOM
Custom entry.
const int GTV_FORBIDDEN
Cannot be voted.
int mv_flags[MAPVOTE_COUNT]
(shared) map/gametype flags
const int MAPVOTE_COUNT
Max number of votable maps/gametypes.
string mv_entries[MAPVOTE_COUNT]
(shared) map name or gametype name
int mv_detail
(shared) how much information about the votes/results is revealed
string mv_ssdirs[MAPVOTE_SSDIRS_COUNT]
int mv_count_real
(shared) number of maps/gametypes, excluding abstain
const int GTV_AVAILABLE
Can be voted.
int mv_votes[MAPVOTE_COUNT]
(shared) number of votes for the map/gametype
const int MAPVOTE_SSDIRS_COUNT
string mv_suggester[MAPVOTE_COUNT]
(maps) .netname of the player who suggested the map
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
bool PlayerStats_GameReport_DelayMapVote
void FixClientCvars(entity e)
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
ClientState CS(Client this)
bool GameTypeVote_Finished(int pos)
string MapVote_Suggest(entity this, string m)
string GameTypeVote_MapInfo_FixName(string m)
void MapVote_AddVotableMaps(int nmax, int smax)
int current_gametype_index
bool GameTypeVote_SetGametype(Gametype type, string gametype_string, bool call_hooks)
vector GameTypeVote_GetMask()
void MapVote_ClearAllVotes()
bool MapVote_CheckRules_decide()
bool MapVote_Finished(int mappos)
bool GameTypeVote_Start()
bool gametypevote_finished
void MapVote_UnzoneStrings()
Gametype GameTypeVote_Type_FromString(string type_name)
Returns the gamtype ID from its name, if type_name isn't a real gametype it checks for sv_vote_gamety...
int GameTypeVote_AvailabilityStatus(string type_name)
void MapVote_CheckRules_count()
bool MapVote_AddVotable(int from_i)
bool GameTypeVote_AddVotable(string nextMode)
void MapVote_ranked_swap(int i, int j, entity pass)
int MapVote_ranked_cmp(int i, int j, entity pass)
#define REDUCE_REMOVE_THIS(idx)
#define autocvar_g_maplist_votable
float mv_rng[MAPVOTE_COUNT]
(shared) random() value for each map/gametype to determine tiebreakers
bool autocvar_sv_vote_gametype
int autocvar_g_maplist_votable_detail
float autocvar_sv_vote_gametype_reduce_time
string autocvar_g_maplist_votable_screenshot_dir
int mv_ranked[MAPVOTE_COUNT]
(shared) maps/gametypes ranked by most votes, first = most
string mv_pakfile[MAPVOTE_COUNT]
(maps) pk3 file location
string voted_gametype_string
float autocvar_sv_vote_gametype_timeout
bool autocvar_g_maplist_votable_suggestions_override_mostrecent
bool autocvar_g_maplist_votable_show_suggester
int mv_suggestion_ptr
(maps) index of where the next suggestion should be (starts as 0)
bool autocvar_sv_vote_gametype_maplist_reset
int mv_voters
(shared) number of human voters present
string autocvar_sv_vote_gametype_options
float autocvar_g_maplist_votable_timeout
bool mv_show_suggester
(maps) whether to show suggesters, only for maps since you can't suggest gametypes
bool autocvar_g_maplist_votable_suggestions
bool autocvar_sv_vote_gametype_default_current
int autocvar_g_maplist_votable_reduce_count
string mv_suggestions[MAPVOTE_COUNT]
(maps) name of the suggested map, later copied into mv_entries
bool autocvar_g_maplist_votable_abstain
int autocvar_rescan_pending
int autocvar_sv_vote_gametype_reduce_count
float autocvar_g_maplist_votable_reduce_time
int mv_ssdir_i[MAPVOTE_COUNT]
(shared) where to look for screenshots (mv_ssdirs index), set to 0 for gametype voting
int autocvar_sv_vote_gametype_detail
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
string loaded_gametype_custom_string
bool gametype_custom_enabled