2002-01-31 23:55:05 +00:00
|
|
|
#include "g_local.h"
|
2002-03-31 03:31:24 +00:00
|
|
|
// JBravo: for warnings
|
2002-06-16 20:06:15 +00:00
|
|
|
int ClientNumberFromString(gentity_t * to, char *s);
|
2002-01-31 23:55:05 +00:00
|
|
|
|
2002-08-23 14:25:05 +00:00
|
|
|
gentity_t *refVotes[2]; // refVotes[0] is the clientnumber red team voted
|
2002-05-12 12:15:05 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
// refVotes[1] is the clientnumber blue team voted
|
2002-06-23 19:12:17 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void SendEndMessage()
|
|
|
|
{
|
2002-06-08 10:51:42 +00:00
|
|
|
|
|
|
|
int mins, secs;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
mins = (int) floor(level.matchTime / 60.0f);
|
|
|
|
secs = level.matchTime - (mins * 60);
|
2002-06-08 10:51:42 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(-1, "cp \"Match is Over!\n\"");
|
|
|
|
trap_SendServerCommand(-1,
|
|
|
|
va("print \"Scores: Team1 [%d] - Team2 [%d] \n\"", level.teamScores[TEAM_RED],
|
|
|
|
level.teamScores[TEAM_BLUE]));
|
|
|
|
trap_SendServerCommand(-1, va("print \"Total Match Time: %d:%02d \n\"", mins, secs));
|
2002-06-08 10:51:42 +00:00
|
|
|
}
|
2002-08-23 14:25:05 +00:00
|
|
|
|
|
|
|
int getNumberOfRefs() {
|
|
|
|
gentity_t *ent;
|
|
|
|
int i,count;
|
|
|
|
count = 0;
|
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
|
|
|
ent = &g_entities[i];
|
|
|
|
if (!ent->inuse)
|
|
|
|
continue;
|
|
|
|
if(ent->client->sess.referee)
|
|
|
|
++count;
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
gentity_t *getEntByName(char *name)
|
|
|
|
{
|
2002-05-12 12:15:05 +00:00
|
|
|
gentity_t *ent;
|
|
|
|
int i;
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2002-05-12 12:15:05 +00:00
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
|
|
|
ent = &g_entities[i];
|
|
|
|
if (!ent->inuse)
|
|
|
|
continue;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!Q_stricmp(ent->client->pers.netname, name))
|
2002-05-12 12:15:05 +00:00
|
|
|
return ent;
|
|
|
|
}
|
|
|
|
return NULL;
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
qboolean checkCaptain(team_t team)
|
|
|
|
{
|
|
|
|
gentity_t *ent;
|
|
|
|
int i;
|
2002-05-12 12:15:05 +00:00
|
|
|
|
2002-02-02 16:34:02 +00:00
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
|
|
|
ent = &g_entities[i];
|
|
|
|
if (!ent->inuse)
|
|
|
|
continue;
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent->client->sess.savedTeam == team && ent->client->sess.captain == team)
|
|
|
|
return qtrue;
|
2002-02-02 16:34:02 +00:00
|
|
|
}
|
|
|
|
return qfalse;
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void MM_RunFrame(void)
|
|
|
|
{
|
2002-01-31 23:55:05 +00:00
|
|
|
int fps;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
fps = trap_Cvar_VariableIntegerValue("sv_fps");
|
2002-05-05 04:23:00 +00:00
|
|
|
|
|
|
|
switch (g_gametype.integer) {
|
2002-06-16 20:06:15 +00:00
|
|
|
//Each Type has different ways of dealing things..
|
2002-05-05 04:23:00 +00:00
|
|
|
case (GT_TEAMPLAY):
|
|
|
|
if (level.team_game_going && level.inGame)
|
2002-06-16 20:06:15 +00:00
|
|
|
level.matchTime += 1.0f / (float) fps;
|
2002-01-31 23:55:05 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-02-02 16:34:02 +00:00
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void MM_Sub_f(gentity_t * ent)
|
|
|
|
{
|
2002-05-05 04:23:00 +00:00
|
|
|
if (!g_RQ3_matchmode.integer)
|
2002-02-02 21:57:58 +00:00
|
|
|
return;
|
2002-05-05 04:23:00 +00:00
|
|
|
if (ent->client->sess.savedTeam == TEAM_SPECTATOR || ent->client->sess.savedTeam == TEAM_FREE) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \"" MM_DENY_COLOR "You need to be on a team for that\n\""));
|
2002-02-02 21:57:58 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-05-05 15:51:16 +00:00
|
|
|
if (ent->client->sess.sub == TEAM_FREE) {
|
2002-06-16 20:06:15 +00:00
|
|
|
// if (ent->client->ps.pm_type == PM_NORMAL) {
|
|
|
|
if (ent->client->sess.sessionTeam != TEAM_SPECTATOR) {
|
|
|
|
ent->flags &= ~FL_GODMODE;
|
|
|
|
ent->client->ps.stats[STAT_HEALTH] = ent->health = 0;
|
|
|
|
player_die(ent, ent, ent, 100000, MOD_SUICIDE);
|
|
|
|
}
|
|
|
|
ent->client->sess.sub = ent->client->sess.savedTeam;
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"%s" MM_OK_COLOR " is now a Substitute for %s.\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->pers.netname,
|
|
|
|
ent->client->sess.savedTeam ==
|
|
|
|
TEAM_BLUE ? g_RQ3_team2name.string : g_RQ3_team1name.string));
|
2002-05-05 04:23:00 +00:00
|
|
|
} else {
|
2002-06-23 15:22:53 +00:00
|
|
|
if(g_RQ3_maxplayers.integer > 0 && (RQ3TeamCount(-1, ent->client->sess.savedTeam) >= g_RQ3_maxplayers.integer)) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \"" MM_DENY_COLOR "Your team is full.\n\""));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->sess.sub = TEAM_FREE;
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"%s" MM_OK_COLOR " is no longer a Substitute for %s.\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->pers.netname,
|
|
|
|
ent->client->sess.savedTeam ==
|
|
|
|
TEAM_BLUE ? g_RQ3_team2name.string : g_RQ3_team1name.string));
|
2002-06-23 15:22:53 +00:00
|
|
|
}
|
2002-02-02 21:57:58 +00:00
|
|
|
}
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void MM_Captain_f(gentity_t * ent)
|
|
|
|
{
|
2002-05-05 04:23:00 +00:00
|
|
|
if (!g_RQ3_matchmode.integer)
|
2002-02-02 20:39:09 +00:00
|
|
|
return;
|
2002-05-05 04:23:00 +00:00
|
|
|
if (ent->client->sess.savedTeam == TEAM_SPECTATOR || ent->client->sess.savedTeam == TEAM_FREE) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \"" MM_DENY_COLOR "You need to be on a team for that\n\""));
|
2002-02-02 16:34:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
if (ent->client->sess.captain == TEAM_RED) {
|
|
|
|
level.team1ready = qfalse;
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"%s" MM_OK_COLOR " is no longer %s's Captain.\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->pers.netname, g_RQ3_team1name.string));
|
|
|
|
ent->client->sess.captain = TEAM_FREE;
|
2002-05-05 15:51:16 +00:00
|
|
|
} else if (ent->client->sess.captain == TEAM_BLUE) {
|
2002-06-16 20:06:15 +00:00
|
|
|
level.team2ready = qfalse;
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"%s" MM_OK_COLOR " is no longer %s's Captain.\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->pers.netname, g_RQ3_team2name.string));
|
|
|
|
ent->client->sess.captain = TEAM_FREE;
|
2002-05-05 04:23:00 +00:00
|
|
|
} else {
|
|
|
|
if (!checkCaptain(ent->client->sess.savedTeam)) {
|
2002-05-05 15:51:16 +00:00
|
|
|
ent->client->sess.captain = ent->client->sess.savedTeam;
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"%s" MM_OK_COLOR " is now %s's Captain.\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->pers.netname,
|
|
|
|
ent->client->sess.savedTeam ==
|
|
|
|
TEAM_BLUE ? g_RQ3_team2name.string : g_RQ3_team1name.string));
|
2002-05-05 04:23:00 +00:00
|
|
|
} else
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \"" MM_DENY_COLOR "Your team already has a Captain\n\""));
|
2002-02-02 21:57:58 +00:00
|
|
|
}
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void MM_Ready_f(gentity_t * ent)
|
|
|
|
{
|
2002-05-05 04:23:00 +00:00
|
|
|
if (!g_RQ3_matchmode.integer)
|
2002-02-02 21:57:58 +00:00
|
|
|
return;
|
|
|
|
|
2002-06-23 19:12:17 +00:00
|
|
|
if(level.inGame && (g_RQ3_mmflags.integer & MMF_UNREADY) != MMF_UNREADY) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow you to un-ready your team after the match started\n\""));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-05 15:51:16 +00:00
|
|
|
if (ent->client->sess.captain != TEAM_FREE) {
|
2002-05-05 04:23:00 +00:00
|
|
|
if (ent->client->sess.savedTeam == TEAM_RED) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("cp \"%s are%s Ready.\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
g_RQ3_team1name.string, level.team1ready ? " no longer" : ""));
|
2002-05-05 04:23:00 +00:00
|
|
|
|
2002-06-07 19:07:08 +00:00
|
|
|
if (level.team1ready)
|
|
|
|
level.team1ready = qfalse;
|
2002-02-02 21:57:58 +00:00
|
|
|
else
|
2002-06-07 19:07:08 +00:00
|
|
|
level.team1ready = qtrue;
|
2002-05-05 04:23:00 +00:00
|
|
|
} else {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("cp \"%s are%s Ready.\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
g_RQ3_team2name.string, level.team2ready ? " no longer" : ""));
|
2002-02-04 00:11:12 +00:00
|
|
|
|
2002-06-07 19:07:08 +00:00
|
|
|
if (level.team2ready)
|
|
|
|
level.team2ready = qfalse;
|
2002-02-02 21:57:58 +00:00
|
|
|
else
|
2002-06-07 19:07:08 +00:00
|
|
|
level.team2ready = qtrue;
|
2002-02-02 21:57:58 +00:00
|
|
|
}
|
2002-05-05 04:23:00 +00:00
|
|
|
} else
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "You need to be a captain for that\n\""));
|
2002-02-08 18:00:34 +00:00
|
|
|
}
|
2002-04-28 11:03:46 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void MM_TeamModel_f(gentity_t * ent)
|
|
|
|
{
|
|
|
|
int args;
|
|
|
|
team_t team;
|
|
|
|
char buff[MAX_TOKEN_CHARS];
|
2002-05-05 04:23:00 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
team = ent->client->sess.savedTeam;
|
|
|
|
if (!g_RQ3_matchmode.integer)
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
|
|
|
if (team == TEAM_SPECTATOR) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
args = trap_Argc();
|
2002-04-28 11:03:46 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (args < 2) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \"Your current team model is:"MM_OK_COLOR" %s\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->sess.savedTeam ==
|
|
|
|
TEAM_RED ? g_RQ3_team1model.string : g_RQ3_team2model.
|
|
|
|
string));
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
|
|
|
} else {
|
2002-06-23 19:12:17 +00:00
|
|
|
if((g_RQ3_mmflags.integer & MMF_TEAMMODEL) != MMF_TEAMMODEL) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow you to change team model\n\""));
|
|
|
|
return;
|
|
|
|
}
|
2002-05-05 15:51:16 +00:00
|
|
|
if (ent->client->sess.captain == TEAM_FREE) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You need to be a captain for that\n\""));
|
2002-04-28 11:03:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (level.team_game_going || level.team_round_going) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \""MM_DENY_COLOR"You cannot change your team's model while playing or ready.\n\""));
|
2002-05-05 04:23:00 +00:00
|
|
|
}
|
2002-04-28 11:03:46 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
trap_Argv(1, buff, sizeof(buff));
|
2002-04-28 11:03:46 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (team == TEAM_RED) {
|
2002-06-07 19:07:08 +00:00
|
|
|
if (level.team1ready) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \"You need to un-ready your team for that..\n\""));
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
2002-04-28 11:03:46 +00:00
|
|
|
}
|
2002-05-05 04:23:00 +00:00
|
|
|
trap_Cvar_Set("g_RQ3_team1model", buff);
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"New Team 1 Model: "MM_OK_COLOR"%s\n\"", buff));
|
2002-05-05 04:23:00 +00:00
|
|
|
} else {
|
2002-06-07 19:07:08 +00:00
|
|
|
if (level.team2ready) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \""MM_DENY_COLOR"You need to un-ready your team for that..\n\""));
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
2002-04-28 11:03:46 +00:00
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Cvar_Set("g_RQ3_team2model", buff);
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"New Team 2 Model: "MM_OK_COLOR"%s\n\"", buff));
|
2002-05-05 04:23:00 +00:00
|
|
|
}
|
|
|
|
}
|
2002-04-28 11:03:46 +00:00
|
|
|
}
|
2002-02-08 18:00:34 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void MM_TeamName_f(gentity_t * ent)
|
|
|
|
{
|
|
|
|
int args;
|
|
|
|
team_t team;
|
|
|
|
char *buff;
|
2002-05-05 04:23:00 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
team = ent->client->sess.savedTeam;
|
|
|
|
if (!g_RQ3_matchmode.integer)
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
|
|
|
if (team == TEAM_SPECTATOR) {
|
|
|
|
return;
|
|
|
|
}
|
2002-04-07 12:49:53 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
args = trap_Argc();
|
2002-04-07 12:49:53 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (args < 2) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \"Your Team Name: " MM_OK_COLOR "%s\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->sess.savedTeam ==
|
|
|
|
TEAM_RED ? g_RQ3_team1name.string : g_RQ3_team2name.
|
|
|
|
string));
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
|
|
|
} else {
|
2002-06-23 19:12:17 +00:00
|
|
|
|
|
|
|
if((g_RQ3_mmflags.integer & MMF_TEAMNAME) != MMF_TEAMNAME) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow you to change team name\n\""));
|
|
|
|
return;
|
|
|
|
}
|
2002-05-05 15:51:16 +00:00
|
|
|
if (ent->client->sess.captain == TEAM_FREE) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You need to be a captain for that\n\""));
|
2002-04-07 12:49:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (level.team_game_going || level.team_round_going) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \""MM_DENY_COLOR"You cannot change your team's name while playing or ready.\n\""));
|
2002-05-05 04:23:00 +00:00
|
|
|
}
|
2002-04-07 12:49:53 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
buff = ConcatArgs(1);
|
2002-04-07 12:49:53 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (strlen(buff) > TEAM_NAME_SIZE)
|
|
|
|
buff[TEAM_NAME_SIZE] = 0;
|
2002-04-07 12:49:53 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (team == TEAM_RED) {
|
2002-06-07 19:07:08 +00:00
|
|
|
if (level.team1ready) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \""MM_DENY_COLOR"You need to un-ready your team for that..\n\""));
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
2002-04-07 12:49:53 +00:00
|
|
|
}
|
2002-05-05 04:23:00 +00:00
|
|
|
trap_Cvar_Set("g_RQ3_team1name", buff);
|
2002-07-26 06:21:43 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"New Team 1 Name: %s\n\"", buff));
|
2002-05-05 04:23:00 +00:00
|
|
|
} else {
|
2002-06-07 19:07:08 +00:00
|
|
|
if (level.team2ready) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \""MM_DENY_COLOR"You need to un-ready your team for that..\n\""));
|
2002-05-05 04:23:00 +00:00
|
|
|
return;
|
2002-04-07 12:49:53 +00:00
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Cvar_Set("g_RQ3_team2name", buff);
|
2002-07-26 06:21:43 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"New Team 2 Name: %s\n\"", buff));
|
2002-05-05 04:23:00 +00:00
|
|
|
}
|
|
|
|
}
|
2002-04-07 12:49:53 +00:00
|
|
|
}
|
|
|
|
|
2002-03-07 00:00:54 +00:00
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
// aasimon: Referee Functions Definition, with some aid functions first
|
2002-03-07 00:00:54 +00:00
|
|
|
//
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void checkRefVotes()
|
|
|
|
{
|
2002-08-23 14:25:05 +00:00
|
|
|
// gentity_t *ent;
|
|
|
|
// char nr[4];
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2002-08-23 14:25:05 +00:00
|
|
|
//G_Printf("Vote Red: %i Vote Blue %i \n", refVotes[0], refVotes[1]);
|
2002-06-16 20:06:15 +00:00
|
|
|
if (refVotes[0] == refVotes[1]) {
|
2002-08-23 14:25:05 +00:00
|
|
|
// ent = g_entities + refVotes[0];
|
|
|
|
refVotes[0]->client->sess.referee = 1;
|
|
|
|
trap_SendServerCommand(-1, va("cp \"%s is now a Referee.\n\"", refVotes[0]->client->pers.netname));
|
|
|
|
refVotes[0] = refVotes[1] = NULL;
|
2002-05-12 12:15:05 +00:00
|
|
|
}
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-05-12 12:15:05 +00:00
|
|
|
/* Slicer - MM_Referee_f
|
|
|
|
For captains to vote a referee*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void MM_Referee_f(gentity_t * ent)
|
|
|
|
{
|
2002-05-12 12:15:05 +00:00
|
|
|
gentity_t *ref;
|
|
|
|
char *buff;
|
|
|
|
team_t captain;
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
if (!g_RQ3_matchmode.integer)
|
2002-05-12 12:15:05 +00:00
|
|
|
return;
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-05-12 12:15:05 +00:00
|
|
|
captain = ent->client->sess.captain;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!g_RQ3_AllowRef.integer) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Allowed on this server\n\""));
|
2002-05-12 12:15:05 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-08-23 14:25:05 +00:00
|
|
|
if (captain == TEAM_FREE) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Only captains can vote a referee\n\""));
|
|
|
|
return;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
if (trap_Argc() < 2) {
|
2002-08-23 14:25:05 +00:00
|
|
|
/*if (Ref_Exists()) {
|
2002-05-12 12:15:05 +00:00
|
|
|
ref = g_entities + g_RQ3_RefID.integer;
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-07-26 06:21:43 +00:00
|
|
|
va("print \"Current Referee: %s\n\"", ref->client->pers.netname));
|
2002-06-16 20:06:15 +00:00
|
|
|
} else
|
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-08-23 14:25:05 +00:00
|
|
|
va("print \""MM_DENY_COLOR"No Referee currently assigned, use referee <name>"MM_DENY_COLOR" to assign\n\""));*/
|
|
|
|
trap_SendServerCommand(ent - g_entities,
|
|
|
|
va("print \""MM_DENY_COLOR"Use referee <name> to vote a referee\n\""));
|
2002-05-12 12:15:05 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-06-23 19:12:17 +00:00
|
|
|
if((g_RQ3_mmflags.integer & MMF_VOTEREF) != MMF_VOTEREF) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow captains to vote for a Referee\n\""));
|
|
|
|
return;
|
|
|
|
}
|
2002-08-23 14:25:05 +00:00
|
|
|
if(getNumberOfRefs() == g_RQ3_maxRefs.integer) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Too many referees already on the server\n\""));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
buff = ConcatArgs(1);
|
|
|
|
if ((ref = getEntByName(buff)) != NULL) {
|
|
|
|
refVotes[captain - 1] = ref;
|
|
|
|
trap_SendServerCommand(-1,
|
|
|
|
va("print \""MM_OK_COLOR"%s has voted %s"MM_OK_COLOR" for referee\n\"",
|
|
|
|
ent->client->pers.netname, ref->client->pers.netname));
|
|
|
|
checkRefVotes();
|
|
|
|
} else {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Name\n\""));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2002-05-12 12:15:05 +00:00
|
|
|
}
|
2002-08-02 22:44:37 +00:00
|
|
|
void MM_ClearScores(qboolean clearTeamFlags)
|
2002-06-16 20:06:15 +00:00
|
|
|
{
|
|
|
|
gentity_t *ent;
|
|
|
|
int i;
|
2002-05-05 04:23:00 +00:00
|
|
|
|
2002-03-07 00:00:54 +00:00
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
|
|
|
ent = &g_entities[i];
|
|
|
|
if (!ent->inuse)
|
|
|
|
continue;
|
2002-08-02 22:44:37 +00:00
|
|
|
if(clearTeamFlags) {
|
|
|
|
ent->client->sess.captain = TEAM_FREE;
|
|
|
|
ent->client->sess.sub = TEAM_FREE;
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
// aasimon: Clear only PERS info. Lata clear all REC information. See if more info is needed to be clean
|
|
|
|
ent->client->ps.persistant[PERS_SCORE] = 0;
|
|
|
|
ent->client->ps.persistant[PERS_KILLED] = 0;
|
2002-05-12 12:15:05 +00:00
|
|
|
ent->client->ps.persistant[PERS_DAMAGE_DELT] = 0;
|
|
|
|
}
|
|
|
|
if (g_gametype.integer == GT_TEAMPLAY) {
|
|
|
|
level.teamScores[TEAM_RED] = 0;
|
|
|
|
level.teamScores[TEAM_BLUE] = 0;
|
2002-03-07 00:00:54 +00:00
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
|
|
|
// aasimon: checks for a ref
|
2002-08-23 14:25:05 +00:00
|
|
|
/*qboolean Ref_Exists(void)
|
2002-06-16 20:06:15 +00:00
|
|
|
{
|
2002-03-07 01:38:36 +00:00
|
|
|
|
|
|
|
if (g_RQ3_RefID.integer == -1)
|
|
|
|
return qfalse;
|
|
|
|
else
|
|
|
|
return qtrue;
|
2002-05-05 04:23:00 +00:00
|
|
|
}
|
2002-08-23 14:25:05 +00:00
|
|
|
*/
|
2002-03-07 00:00:54 +00:00
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
// aasimon: Ref Auth. Do some kind of logging (ip's etc)
|
2002-03-07 00:00:54 +00:00
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
qboolean Ref_Auth(gentity_t * ent)
|
|
|
|
{
|
|
|
|
char pass[MAX_TOKEN_CHARS];
|
2002-08-23 14:25:05 +00:00
|
|
|
// int cn;
|
|
|
|
// char teste[2];
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (!g_RQ3_AllowRef.integer) {
|
2002-03-07 00:00:54 +00:00
|
|
|
// No ref allowed on the server - HELLO!!!!! FIREMAN CARS????
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Allowed on this server\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
2002-08-23 14:25:05 +00:00
|
|
|
if(!g_RQ3_matchmode.integer) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"This server is not running match mode\n\""));
|
|
|
|
return qfalse;
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (Q_stricmp(g_RQ3_RefPass.string, "") == 0) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Password Set on this server\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
return qfalse;
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
|
|
|
|
2002-08-23 14:25:05 +00:00
|
|
|
/* if (Ref_Exists()) {
|
2002-03-07 00:00:54 +00:00
|
|
|
// One ref per match
|
2002-06-16 20:06:15 +00:00
|
|
|
cn = ent - g_entities;
|
2002-03-07 01:38:36 +00:00
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
if (cn == g_RQ3_RefID.integer) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are already the referee\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Referee already set on this server\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
return qfalse;
|
2002-08-23 14:25:05 +00:00
|
|
|
}*/
|
|
|
|
if(getNumberOfRefs() == g_RQ3_maxRefs.integer) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Too many referees already on the server\n\""));
|
|
|
|
return qfalse;
|
|
|
|
}
|
|
|
|
if (ent->client->sess.referee) {
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are already the referee\n\""));
|
|
|
|
return qfalse;
|
2002-03-07 00:00:54 +00:00
|
|
|
}
|
2002-05-05 04:23:00 +00:00
|
|
|
trap_Argv(1, pass, sizeof(pass));
|
2002-08-23 14:25:05 +00:00
|
|
|
|
2002-03-07 00:00:54 +00:00
|
|
|
|
|
|
|
// Does a simple plain text auth
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(pass, g_RQ3_RefPass.string) == 0) {
|
2002-08-23 14:25:05 +00:00
|
|
|
ent->client->sess.referee = 1;
|
|
|
|
trap_SendServerCommand(-1,
|
|
|
|
va("print \"%s "MM_OK_COLOR"is now a Referee\n\"",
|
|
|
|
ent->client->pers.netname));
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
/* if (Q_stricmp(pass, g_RQ3_RefPass.string) == 0) {
|
2002-06-16 20:06:15 +00:00
|
|
|
cn = ent - g_entities;
|
2002-03-07 01:38:36 +00:00
|
|
|
Com_sprintf(teste, 3, "%i", cn);
|
|
|
|
trap_Cvar_Set("g_RQ3_RefID", teste);
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(-1,
|
2002-07-26 06:21:43 +00:00
|
|
|
va("print \"%s "MM_OK_COLOR"is the new Referee\n\"",
|
2002-06-16 20:06:15 +00:00
|
|
|
ent->client->pers.netname));
|
2002-03-07 00:00:54 +00:00
|
|
|
return qtrue;
|
2002-06-16 20:06:15 +00:00
|
|
|
}
|
2002-08-23 14:25:05 +00:00
|
|
|
*/
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Referee Password\n\""));
|
2002-05-05 04:23:00 +00:00
|
|
|
|
2002-03-07 00:00:54 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
2002-08-02 22:44:37 +00:00
|
|
|
// MM_ResetMatch by Slicer
|
|
|
|
// Used by admin or rcon to reset Match settings, that is subs, captains, scores, teams's status and game status
|
|
|
|
//
|
|
|
|
void MM_ResetMatch() {
|
|
|
|
trap_SendServerCommand(-1, va("print \""MM_OK_COLOR" Reseting Server Match Status...\n\""));
|
|
|
|
// CleanUp Scores and Team Status
|
|
|
|
MM_ClearScores(qtrue);
|
|
|
|
// Just in case
|
|
|
|
MakeAllLivePlayersObservers();
|
|
|
|
level.team1ready = qfalse;
|
|
|
|
level.team2ready = qfalse;
|
|
|
|
level.inGame = qfalse;
|
|
|
|
level.team_game_going = 0;
|
|
|
|
level.team_round_going = 0;
|
|
|
|
level.team_round_countdown = 0;
|
|
|
|
level.matchTime = 0;
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
|
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
// aasimon: processes comands sent from the referee
|
2002-03-07 00:00:54 +00:00
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
void Ref_Command(gentity_t * ent)
|
|
|
|
{
|
|
|
|
char com[MAX_TOKEN_CHARS];
|
2002-06-23 03:04:09 +00:00
|
|
|
char param[MAX_TOKEN_CHARS];
|
2002-08-27 04:48:13 +00:00
|
|
|
char arg2[MAX_STRING_CHARS];
|
|
|
|
int cn, i;
|
2002-03-07 00:00:54 +00:00
|
|
|
|
2002-08-23 14:25:05 +00:00
|
|
|
//cn = ent - g_entities;
|
|
|
|
if (!ent->client->sess.referee) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are not a referee\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Argv(1, com, sizeof(com));
|
2002-03-07 00:00:54 +00:00
|
|
|
|
|
|
|
// nice strcmp for each comand (borring, wheres my beer?)
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(com, "help") == 0) {
|
2002-03-07 00:00:54 +00:00
|
|
|
// Theres a clean way to do this - add more help here (this is for example only)
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, "print \"kick player\n\"");
|
|
|
|
trap_SendServerCommand(ent - g_entities, "print \"map_restart\n\"");
|
|
|
|
trap_SendServerCommand(ent - g_entities, "print \"clearscores\n\"");
|
|
|
|
trap_SendServerCommand(ent - g_entities, "print \"pause\n\"");
|
2002-06-18 03:57:38 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, "print \"cyclemap\n\"");
|
2002-06-20 18:40:17 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, "print\"lockSettings\n\"");
|
2002-08-02 22:44:37 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, "print \"resetMatch\n\"");
|
2002-06-23 03:04:09 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, "print\"map <map_to_go>\n\"");
|
2002-08-27 04:48:13 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, "print\"say <text>\n\"");
|
2002-06-20 18:40:17 +00:00
|
|
|
return;
|
2002-08-02 22:44:37 +00:00
|
|
|
} else if (Q_stricmp(com, "resetMatch") == 0) {
|
|
|
|
MM_ResetMatch();
|
|
|
|
return;
|
2002-06-20 18:40:17 +00:00
|
|
|
} else if (Q_stricmp(com, "lockSettings") == 0) {
|
2002-07-07 21:12:52 +00:00
|
|
|
if(level.settingsLocked) {
|
2002-06-20 18:40:17 +00:00
|
|
|
level.settingsLocked = qfalse;
|
2002-07-07 21:12:52 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
|
|
|
va("print \""MM_OK_COLOR"Settings are now unLocked\n\""));
|
|
|
|
}
|
|
|
|
else {
|
2002-06-20 18:40:17 +00:00
|
|
|
level.settingsLocked = qtrue;
|
2002-07-07 21:12:52 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
|
|
|
va("print \""MM_OK_COLOR"Settings are now Locked\n\""));
|
|
|
|
}
|
2002-03-07 00:00:54 +00:00
|
|
|
return;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (Q_stricmp(com, "kick") == 0) { // kick kick kick
|
|
|
|
trap_Argv(2, com, sizeof(com));
|
|
|
|
if (Q_stricmp(com, "") == 0) {
|
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-07-26 06:21:43 +00:00
|
|
|
va("print \""MM_DENY_COLOR"You must name a player. Use: ref kick <player_name>\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-05-05 04:23:00 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
cn = ClientNumberFromString(ent, com);
|
2002-05-05 04:23:00 +00:00
|
|
|
if (cn == -1) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-07-26 06:21:43 +00:00
|
|
|
va("print \"%s "MM_DENY_COLOR"is not on the server\n\"", com));
|
2002-03-07 00:00:54 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-05-05 04:23:00 +00:00
|
|
|
trap_DropClient(cn, "was kicked by the referee");
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (Q_stricmp(com, "clearscores") == 0) {
|
2002-08-02 22:44:37 +00:00
|
|
|
MM_ClearScores(qfalse);
|
2002-03-07 00:00:54 +00:00
|
|
|
return;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (Q_stricmp(com, "map_restart") == 0) {
|
2002-03-07 00:00:54 +00:00
|
|
|
// this is having problems, namely diference from rcon map_restart or using this trap
|
|
|
|
// Ok here it goes: doing map_restart with players IN THE GAME forces them to specs but
|
|
|
|
// the scoreboard still shows the players in the team.
|
|
|
|
// Second thing is: remove the stupid 5-4-3-2-1 if doing map_restart i (with i > 0)
|
|
|
|
|
2002-05-05 04:23:00 +00:00
|
|
|
trap_SendConsoleCommand(EXEC_APPEND, "map_restart 0\n");
|
2002-03-07 00:00:54 +00:00
|
|
|
return;
|
2002-06-16 20:06:15 +00:00
|
|
|
} else if (Q_stricmp(com, "pause") == 0) {
|
2002-05-05 04:23:00 +00:00
|
|
|
if (level.paused) {
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(-1, "cp \"Game resumed by Referee.\n\"");
|
2002-04-28 17:28:27 +00:00
|
|
|
level.paused = qfalse;
|
2002-05-05 04:23:00 +00:00
|
|
|
} else {
|
|
|
|
if (level.team_game_going) {
|
|
|
|
if (level.inGame)
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \""MM_OK_COLOR"Game will be paused at the end of the round"));
|
2002-04-28 11:03:46 +00:00
|
|
|
else
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(-1, va("cp \"Game is now paused by the Referee\""));
|
2002-04-28 17:28:27 +00:00
|
|
|
level.paused = qtrue;
|
2002-05-05 04:23:00 +00:00
|
|
|
} else
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No game is going.."));
|
2002-04-28 11:03:46 +00:00
|
|
|
}
|
2002-06-18 03:57:38 +00:00
|
|
|
} else if (Q_stricmp(com, "cyclemap") == 0){
|
|
|
|
BeginIntermission();
|
2002-06-23 03:04:09 +00:00
|
|
|
} else if (Q_stricmp(com, "map") == 0){
|
|
|
|
// get map name
|
|
|
|
trap_Argv(2, param, sizeof(param));
|
|
|
|
|
|
|
|
if ( !G_FileExists(va("maps/%s.bsp", param)) ) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"The map %s does not exist.\n\"", param));
|
2002-06-23 03:04:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
trap_Cvar_Set("g_RQ3_ValidIniFile", "3");
|
|
|
|
g_RQ3_ValidIniFile.integer = 3;
|
2002-07-26 06:21:43 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \""MM_OK_COLOR"Referee changed next map to: %s\n\"", param));
|
2002-06-23 03:04:09 +00:00
|
|
|
Com_sprintf(level.voteMap, sizeof(level.voteMap), "map %s",param);
|
|
|
|
BeginIntermission();
|
|
|
|
}
|
|
|
|
}
|
2002-08-27 04:48:13 +00:00
|
|
|
else if (Q_stricmp(com, "say") == 0) {
|
|
|
|
arg2[0] = '\0';
|
|
|
|
for (i = 2; i < trap_Argc(); i++) {
|
|
|
|
if (i > 2)
|
|
|
|
strcat(arg2, " ");
|
|
|
|
trap_Argv(i, &arg2[strlen(arg2)], sizeof(arg2) - strlen(arg2));
|
|
|
|
}
|
|
|
|
|
|
|
|
G_Say(ent, NULL, SAY_REF, arg2);
|
|
|
|
}
|
2002-06-23 03:04:09 +00:00
|
|
|
else
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities,
|
2002-06-23 15:22:53 +00:00
|
|
|
va("print \""MM_DENY_COLOR"Invalid Referee comand. Type ref help to see a list of available commands\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
void Ref_Resign(gentity_t * ent)
|
|
|
|
{
|
2002-08-23 14:25:05 +00:00
|
|
|
if (ent->client->sess.referee) {
|
|
|
|
ent->client->sess.referee = 0;
|
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_OK_COLOR"You resign from your referee status\n\""));
|
2002-03-07 00:00:54 +00:00
|
|
|
}
|
|
|
|
}
|
2002-06-20 18:40:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Timelimit
|
|
|
|
RoundLimit
|
|
|
|
RoundTimeLimit
|
|
|
|
Fraglimit
|
2002-06-23 15:22:53 +00:00
|
|
|
Max Players
|
2002-06-20 18:40:17 +00:00
|
|
|
Friendly Fire
|
|
|
|
Chase Cam
|
|
|
|
Team Grenades
|
|
|
|
---> Irvision Doesnt Exist.
|
|
|
|
Force Team Talk
|
|
|
|
*/
|
|
|
|
#define NR_SETTVARS 9
|
|
|
|
|
2002-07-26 06:21:43 +00:00
|
|
|
const char *settings[] = {"timelimit", "g_RQ3_roundlimit", "g_RQ3_roundtimelimit", "fraglimit", "g_RQ3_maxplayers",
|
|
|
|
"g_RQ3_forceteamtalk", "g_RQ3_limchasecam","g_RQ3_tgren","g_friendlyFire"};
|
|
|
|
// JBravo: adding settings2 for cvars to set in the client for the MM ingame menu.
|
|
|
|
const char *settings2[] = {"cg_RQ3_timelimit", "cg_RQ3_roundlimit", "cg_RQ3_roundtimelimit", "cg_RQ3_fraglimit",
|
|
|
|
"cg_RQ3_maxplayers", "cg_RQ3_forceteamtalk", "cg_RQ3_limchasecam", "cg_RQ3_tgren", "cg_RQ3_friendlyFire"};
|
2002-06-20 18:40:17 +00:00
|
|
|
|
|
|
|
void MM_Settings_f(gentity_t * ent) {
|
|
|
|
int i;
|
|
|
|
char str[MAX_TOKEN_CHARS];
|
|
|
|
|
|
|
|
if (!g_RQ3_matchmode.integer)
|
|
|
|
return;
|
|
|
|
|
|
|
|
//Invalid Data SENT
|
2002-07-26 06:21:43 +00:00
|
|
|
if (trap_Argc() -1 != NR_SETTVARS) {
|
2002-06-20 18:40:17 +00:00
|
|
|
return;
|
2002-07-04 16:05:32 +00:00
|
|
|
}
|
2002-06-23 19:12:17 +00:00
|
|
|
|
2002-07-26 06:21:43 +00:00
|
|
|
if ((g_RQ3_mmflags.integer & MMF_SETTINGS) != MMF_SETTINGS) {
|
2002-06-23 19:12:17 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow you to change settings\n\""));
|
|
|
|
return;
|
|
|
|
}
|
2002-08-23 14:25:05 +00:00
|
|
|
if (ent->client->sess.captain == TEAM_FREE && !ent->client->sess.referee) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Only Captains and Referees can change match Settings\n\""));
|
2002-06-20 18:40:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//Game has begun
|
2002-07-26 06:21:43 +00:00
|
|
|
if (level.inGame) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Settings can only be changed before a game starts\n\""));
|
2002-06-20 18:40:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//Referee locked settings
|
2002-07-26 06:21:43 +00:00
|
|
|
if (level.settingsLocked) {
|
2002-06-23 15:22:53 +00:00
|
|
|
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Settings are currently locked, only Referee can unlock them\n\""));
|
2002-06-20 18:40:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-07-26 06:21:43 +00:00
|
|
|
for (i = 0; i < NR_SETTVARS; ++i) {
|
2002-06-20 18:40:17 +00:00
|
|
|
trap_Argv(i+1, str, sizeof(str));
|
|
|
|
trap_Cvar_Set(settings[i],str);
|
2002-07-26 06:21:43 +00:00
|
|
|
// JBravo: setting the cvars in cgame now.
|
|
|
|
trap_SendServerCommand(-1, va("rq3_cmd %i %s %s", CVARSET, settings2[i], str));
|
2002-06-20 18:40:17 +00:00
|
|
|
}
|
|
|
|
|
2002-07-26 06:21:43 +00:00
|
|
|
trap_SendServerCommand(-1,va("print \""MM_OK_COLOR"Match Settings have been changed by %s\n\"",ent->client->pers.netname));
|
2002-06-20 18:40:17 +00:00
|
|
|
|
|
|
|
}
|