Adapted Vote system to Matchmode

This commit is contained in:
Daniel Simoes 2002-08-07 20:49:21 +00:00
parent 2207a53a8e
commit 07e9fe7913
3 changed files with 36 additions and 10 deletions

View file

@ -30,6 +30,8 @@
* No rcon stuff command alowed in matchmode
* Ignorenum bug (ignoring player no. 0) fixed
* Case carrier glowing removed.
* MM: Changed Voting system to allow only captains to vote/callvote
* MM: Added "clearscores" and "resetmatch" to vote command list
# List fixes here for the 2.1 release

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.157 2002/08/07 20:49:21 slicer
// Adapted Vote system to Matchmode
//
// Revision 1.156 2002/07/16 04:08:28 niceass
// temporary hack solution for map rotation and ctb
//
@ -1865,7 +1868,6 @@ void Cmd_CallVote_f(gentity_t * ent)
trap_SendServerCommand(ent - g_entities, "print \"Voting not allowed here.\n\"");
return;
}
if (level.voteTime) {
trap_SendServerCommand(ent - g_entities, "print \"A vote is already in progress.\n\"");
return;
@ -1878,6 +1880,11 @@ void Cmd_CallVote_f(gentity_t * ent)
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR && g_gametype.integer != GT_TEAMPLAY) {
trap_SendServerCommand(ent - g_entities, "print \"Not allowed to call a vote as spectator.\n\"");
return;
}
//Slicer Matchmode
if(g_RQ3_matchmode.integer && ent->client->sess.captain == TEAM_FREE) {
trap_SendServerCommand(ent - g_entities, "print \"Only team Captains can start a vote.\n\"");
return;
}
// make sure it is a valid command to vote on
trap_Argv(1, arg1, sizeof(arg1));
@ -1887,17 +1894,28 @@ void Cmd_CallVote_f(gentity_t * ent)
trap_SendServerCommand(ent - g_entities, "print \"Invalid vote string.\n\"");
return;
}
if (!Q_stricmp(arg1, "cyclemap")) {
if (!Q_stricmp(arg1, "cyclemap")) {
} else if (!Q_stricmp(arg1, "map")) {
} else if (!Q_stricmp(arg1, "g_gametype")) {
} else if (!Q_stricmp(arg1, "kick")) {
} else if (!Q_stricmp(arg1, "clientkick")) {
} else {
trap_SendServerCommand(ent - g_entities, "print \"Invalid vote command.\n\"");
trap_SendServerCommand(ent - g_entities,
"print \"Valid vote commands are: cyclemap, map <mapname>, g_gametype <n>, kick <player>, and clientkick <clientnum>.\n\"");
if(g_RQ3_matchmode.integer) {
if (!Q_stricmp(arg1, "resetmatch")) {
} else if (!Q_stricmp(arg1, "clearscores")) {
} else {
trap_SendServerCommand(ent - g_entities, "print \"Invalid vote command.\n\"");
trap_SendServerCommand(ent - g_entities,"print \"Valid vote commands are: cyclemap, map <mapname>, g_gametype <n>, kick <player>, clientkick <clientnum>,clearscores,resetmatch.\n\"");
return;
}
}
else {
trap_SendServerCommand(ent - g_entities, "print \"Invalid vote command.\n\"");
trap_SendServerCommand(ent - g_entities,
"print \"Valid vote commands are: cyclemap, map <mapname>, g_gametype <n>, kick <player>, and clientkick <clientnum>.\n\"");
return;
}
}
// if there is still a vote to be executed
@ -1982,7 +2000,11 @@ void Cmd_Vote_f(gentity_t * ent)
trap_SendServerCommand(ent - g_entities, "print \"Not allowed to vote as spectator.\n\"");
return;
}
//Slicer Matchmode
if(g_RQ3_matchmode.integer && ent->client->sess.captain == TEAM_FREE) {
trap_SendServerCommand(ent - g_entities, "print \"Only team Captains vote.\n\"");
return;
}
trap_SendServerCommand(ent - g_entities, "print \"Vote cast.\n\"");
ent->client->ps.eFlags |= EF_VOTED;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.106 2002/08/07 20:49:21 slicer
// Adapted Vote system to Matchmode
//
// Revision 1.105 2002/07/26 22:28:38 jbravo
// Fixed the server about menu, made the UI handle illegal models and skins
// better.
@ -1378,7 +1381,6 @@ void CalculateRanks(void)
}
}
}
qsort(level.sortedClients, level.numConnectedClients, sizeof(level.sortedClients[0]), SortRanks);
// set the rank value for all clients that are connected and not spectators
@ -2202,11 +2204,11 @@ void CheckVote(void)
if (level.time - level.voteTime >= VOTE_TIME) {
trap_SendServerCommand(-1, "print \"Vote failed.\n\"");
} else {
if (level.voteYes > level.numVotingClients / 2) {
if ((g_RQ3_matchmode.integer ? level.voteYes == 2 : (level.voteYes > level.numVotingClients / 2))) {
// execute the command, then remove the vote
trap_SendServerCommand(-1, "print \"Vote passed.\n\"");
level.voteExecuteTime = level.time + 3000;
} else if (level.voteNo >= level.numVotingClients / 2) {
} else if ((g_RQ3_matchmode.integer ? level.voteNo == 1 : level.voteNo >= level.numVotingClients / 2)) {
// same behavior as a timeout
trap_SendServerCommand(-1, "print \"Vote failed.\n\"");
} else {