mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-26 22:21:16 +00:00
Added a skeleton referee suport, with some functional commands (map_restart and kick)
This commit is contained in:
parent
46fa882354
commit
ac06519641
5 changed files with 194 additions and 5 deletions
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.67 2002/03/07 00:00:54 assimon
|
||||
// Added a skeleton referee suport, with some functional commands (map_restart and kick)
|
||||
//
|
||||
// Revision 1.66 2002/03/03 21:46:26 blaze
|
||||
// weapon stats, done, beta test for bugs
|
||||
//
|
||||
|
@ -2835,6 +2838,13 @@ void ClientCommand( int clientNum ) {
|
|||
MM_Ready_f( ent );
|
||||
else if (Q_stricmp (cmd, "sub") == 0)
|
||||
MM_Sub_f( ent );
|
||||
// aasimon: referee for MM
|
||||
else if (Q_stricmp (cmd, "reflogin") == 0)
|
||||
Ref_Auth ( ent );
|
||||
else if (Q_stricmp (cmd, "ref") == 0)
|
||||
Ref_Command ( ent );
|
||||
else if (Q_stricmp (cmd, "refresign") == 0)
|
||||
Ref_Resign ( ent );
|
||||
|
||||
// Begin Duffman
|
||||
else if (Q_stricmp (cmd, "reload") == 0)
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.49 2002/03/07 00:00:54 assimon
|
||||
// Added a skeleton referee suport, with some functional commands (map_restart and kick)
|
||||
//
|
||||
// Revision 1.48 2002/02/24 18:12:19 jbravo
|
||||
// Added a cvar to control sniper behavior g_RQ3_sniperup. Def 0. if set yo 1
|
||||
// it makes players spawn with the sniper up.
|
||||
|
@ -339,6 +342,9 @@ typedef struct {
|
|||
team_t captain;
|
||||
team_t sub;
|
||||
clientConnected_t connected;
|
||||
// aasimon: Ref indicator for MM
|
||||
qboolean referee;
|
||||
|
||||
usercmd_t cmd; // we would lose angles if not persistant
|
||||
qboolean localClient; // true if "ip" info key is "localhost"
|
||||
qboolean initialSpawn; // the first spawn should be at a cool location
|
||||
|
@ -1094,6 +1100,9 @@ extern vmCvar_t RQ3_lca; // JBravo: cvar to signal cgame that LCA is in progre
|
|||
//Slicer: Team Status Cvars for MM
|
||||
extern vmCvar_t RQ3_team1;
|
||||
extern vmCvar_t RQ3_team2;
|
||||
//aasimon: Ref System for MM
|
||||
extern vmCvar_t g_RQ3_AllowRef;
|
||||
extern vmCvar_t g_RQ3_RefPass;
|
||||
|
||||
void trap_Printf( const char *fmt );
|
||||
void trap_Error( const char *fmt );
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.26 2002/03/07 00:00:54 assimon
|
||||
// Added a skeleton referee suport, with some functional commands (map_restart and kick)
|
||||
//
|
||||
// Revision 1.25 2002/03/01 18:50:26 makro
|
||||
// Added CVAR_ARCHIVE flag to some g_RQ3 cvars
|
||||
//
|
||||
|
@ -136,6 +139,10 @@ vmCvar_t RQ3_lca;
|
|||
//Slicer: Team Status Cvars for MM
|
||||
vmCvar_t RQ3_team1;
|
||||
vmCvar_t RQ3_team2;
|
||||
// aasimon: Ref System for MM
|
||||
vmCvar_t g_RQ3_AllowRef;
|
||||
vmCvar_t g_RQ3_RefPass;
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
vmCvar_t g_obeliskHealth;
|
||||
vmCvar_t g_obeliskRegenPeriod;
|
||||
|
@ -261,7 +268,10 @@ static cvarTable_t gameCvarTable[] = {
|
|||
{ &RQ3_lca, "RQ3_lca", "0", CVAR_SYSTEMINFO, 0, qfalse},
|
||||
//Slicer: Team Status Cvars for MM
|
||||
{ &RQ3_team1, "RQ3_team1", "0", CVAR_SYSTEMINFO, 0, qfalse},
|
||||
{ &RQ3_team2, "RQ3_team2", "0", CVAR_SYSTEMINFO, 0, qfalse}
|
||||
{ &RQ3_team2, "RQ3_team2", "0", CVAR_SYSTEMINFO, 0, qfalse},
|
||||
// aasimon: Ref system for MM
|
||||
{ &g_RQ3_AllowRef, "g_RQ3_AllowRef", "0", CVAR_SERVERINFO, 0, qtrue},
|
||||
{ &g_RQ3_RefPass, "g_RQ3_RefPassword", "", CVAR_USERINFO, 0, qfalse}
|
||||
|
||||
};
|
||||
|
||||
|
@ -439,6 +449,7 @@ void G_RegisterCvars( void ) {
|
|||
G_RemapTeamShaders();
|
||||
}
|
||||
|
||||
G_Printf("Testing\n");
|
||||
// check some things
|
||||
if ( g_gametype.integer < 0 || g_gametype.integer >= GT_MAX_GAME_TYPE ) {
|
||||
G_Printf( "g_gametype %i is out of range, defaulting to 0\n", g_gametype.integer );
|
||||
|
|
|
@ -12,6 +12,7 @@ qboolean checkCaptain(team_t team) {
|
|||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
void MM_RunFrame(void) {
|
||||
int fps;
|
||||
|
||||
|
@ -26,6 +27,7 @@ void MM_RunFrame(void) {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
void MM_Sub_f( gentity_t *ent) {
|
||||
if(!g_RQ3_matchmode.integer)
|
||||
return;
|
||||
|
@ -51,6 +53,7 @@ void MM_Sub_f( gentity_t *ent) {
|
|||
ent->client->sess.savedTeam==TEAM_BLUE ? "Blue Team": "Red Team"));
|
||||
}
|
||||
}
|
||||
|
||||
void MM_Captain_f( gentity_t *ent ) {
|
||||
if(!g_RQ3_matchmode.integer)
|
||||
return;
|
||||
|
@ -81,6 +84,7 @@ void MM_Captain_f( gentity_t *ent ) {
|
|||
trap_SendServerCommand(ent-g_entities, "print \"Your team already has a Captain\n\"");
|
||||
}
|
||||
}
|
||||
|
||||
void MM_Ready_f(gentity_t *ent) {
|
||||
if(!g_RQ3_matchmode.integer)
|
||||
return;
|
||||
|
@ -112,3 +116,152 @@ void MM_Ready_f(gentity_t *ent) {
|
|||
|
||||
}
|
||||
|
||||
//
|
||||
// aasimon: Referee Functions Definition, with some aid functions first
|
||||
//
|
||||
|
||||
|
||||
// aasimon: perhaps in another place...but lets see
|
||||
|
||||
void MM_ClearScores ( void ){
|
||||
gentity_t *ent;
|
||||
int i;
|
||||
for (i = 0; i < level.maxclients; i++) {
|
||||
ent = &g_entities[i];
|
||||
if (!ent->inuse)
|
||||
continue;
|
||||
|
||||
// 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;
|
||||
|
||||
if ( g_gametype.integer == GT_TEAMPLAY ){
|
||||
level.teamScores[TEAM_RED] = 0;
|
||||
level.teamScores[TEAM_BLUE] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// aasimon: checks for a ref
|
||||
qboolean Ref_Exists( void ){
|
||||
gentity_t *ent;
|
||||
int i;
|
||||
for (i = 0; i < level.maxclients; i++) {
|
||||
ent = &g_entities[i];
|
||||
if (!ent->inuse)
|
||||
continue;
|
||||
if(ent->client->pers.referee == qtrue)
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
//
|
||||
// aasimon: Ref Auth. Do some kind of logging (ip's etc)
|
||||
//
|
||||
qboolean Ref_Auth( gentity_t *ent ){
|
||||
char pass[MAX_TOKEN_CHARS];
|
||||
|
||||
if ( !g_RQ3_AllowRef.integer ){
|
||||
// No ref allowed on the server - HELLO!!!!! FIREMAN CARS????
|
||||
trap_SendServerCommand( ent-g_entities, "print \"No Referee Allowed on this server\n\"" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( Q_stricmp(g_RQ3_RefPass.string, "") == 0){
|
||||
trap_SendServerCommand( ent-g_entities, "print \"No Referee Password Set on this server\n\"" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( Ref_Exists() ){
|
||||
// One ref per match
|
||||
if ( ent->client->pers.referee ){
|
||||
trap_SendServerCommand ( ent-g_entities, "print \"You are already the referee\n\"" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
trap_SendServerCommand( ent-g_entities, "print \"Referee already set on this server\n\"" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
||||
trap_Argv( 1, pass, sizeof( pass ) );
|
||||
|
||||
// Does a simple plain text auth
|
||||
|
||||
if ( Q_stricmp (pass, g_RQ3_RefPass.string) == 0) {
|
||||
ent->client->pers.referee = qtrue;
|
||||
trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " is the new Referee\n\"", ent->client->pers.netname) );
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
trap_SendServerCommand( ent-g_entities, "print \"Invalid Referee Password\n\"" );
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
//
|
||||
// aasimon: processes comands sent from the referee
|
||||
//
|
||||
void Ref_Command ( gentity_t *ent){
|
||||
char com[MAX_TOKEN_CHARS];
|
||||
int cn;
|
||||
|
||||
if (!ent->client->pers.referee) {
|
||||
trap_SendServerCommand( ent-g_entities, "print \"You are not a referee\n\"" );
|
||||
return;
|
||||
}
|
||||
|
||||
trap_Argv ( 1, com, sizeof ( com ) );
|
||||
|
||||
// nice strcmp for each comand (borring, wheres my beer?)
|
||||
if ( Q_stricmp (com, "help") == 0){
|
||||
// Theres a clean way to do this - add more help here (this is for example only)
|
||||
trap_SendServerCommand( ent-g_entities, "print \"kick player\n\"" );
|
||||
trap_SendServerCommand( ent-g_entities, "print \"map_restart\n\"" );
|
||||
trap_SendServerCommand( ent-g_entities, "print \"clear_scores\n\"" );
|
||||
trap_SendServerCommand( ent-g_entities, "print \"timeout\n\"" );
|
||||
return;
|
||||
|
||||
} 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, "print \"You must name a player. Use: ref kick <player_name>\n\"" );
|
||||
return;
|
||||
}
|
||||
|
||||
cn = ClientNumberFromString( ent, com );
|
||||
if ( cn == -1 ){
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"%s" S_COLOR_WHITE " is not on the server\n\"", com) );
|
||||
return;
|
||||
}
|
||||
trap_DropClient( cn, "was kicked by the referee" );
|
||||
|
||||
|
||||
} else if( Q_stricmp (com, "clearscores") == 0 ){
|
||||
MM_ClearScores();
|
||||
return;
|
||||
} else if (Q_stricmp (com, "map_restart") == 0 ){
|
||||
// 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)
|
||||
|
||||
trap_SendConsoleCommand( EXEC_APPEND, "map_restart 0\n" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
trap_SendServerCommand( ent-g_entities, "print \"Invalid Referee comand. Type ref help to see a list of available commands\n\"" );
|
||||
|
||||
}
|
||||
|
||||
void Ref_Resign ( gentity_t *ent ){
|
||||
if (!ent->client->pers.referee) {
|
||||
trap_SendServerCommand( ent-g_entities, "print \"You are not a referee\n\"" );
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->pers.referee = qfalse;
|
||||
trap_SendServerCommand ( ent-g_entities, "print \"You resign from your referee status\n\"");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
void MM_RunFrame( void );
|
||||
void MM_Captain_f(gentity_t *ent );
|
||||
void MM_Sub_f( gentity_t *ent);
|
||||
void MM_Ready_f(gentity_t *ent);
|
||||
void MM_RunFrame( void );
|
||||
void MM_Captain_f(gentity_t *ent );
|
||||
void MM_Sub_f( gentity_t *ent);
|
||||
void MM_Ready_f(gentity_t *ent);
|
||||
void MM_ClearScores( void );
|
||||
|
||||
// aasimon: Declarations for Ref system
|
||||
qboolean Ref_Exists( void );
|
||||
qboolean Ref_Auth( gentity_t *); // No need to return a boolean in this context
|
||||
void Ref_Command ( gentity_t * );
|
||||
void Ref_Resign ( gentity_t * );
|
||||
|
|
Loading…
Reference in a new issue