Changed Ref System. New cvar added - g_RQ3_RefID. Now referee is peserved even on map changes or map_restarts.

This commit is contained in:
Bruno Covachã 2002-03-07 01:38:36 +00:00
parent fd2405125f
commit 491daea2d1
4 changed files with 43 additions and 11 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.46 2002/03/07 01:38:36 assimon
// Changed Ref System. New cvar added - g_RQ3_RefID. Now referee is peserved even on map changes or map_restarts.
//
// Revision 1.45 2002/03/03 13:49:28 jbravo
// Initializing weapon modes on connect.
//
@ -1626,6 +1629,11 @@ void ClientDisconnect( int clientNum ) {
}
}
// aasimon: Referee. If player is referee, clean ref
if(clientNum == g_RQ3_RefID.integer)
trap_Cvar_Set("g_RQ3_RefID", "-1");
// stop any following clients
for ( i = 0 ; i < level.maxclients ; i++ ) {
if ( level.clients[i].sess.sessionTeam == TEAM_SPECTATOR

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.50 2002/03/07 01:38:36 assimon
// Changed Ref System. New cvar added - g_RQ3_RefID. Now referee is peserved even on map changes or map_restarts.
//
// Revision 1.49 2002/03/07 00:00:54 assimon
// Added a skeleton referee suport, with some functional commands (map_restart and kick)
//
@ -342,8 +345,9 @@ typedef struct {
team_t captain;
team_t sub;
clientConnected_t connected;
// aasimon: Ref indicator for MM
qboolean referee;
// aasimon: No Need for this here, using a cvar to record the clientnumber of referee, so that map_restarts dont change
// the referee
// qboolean referee;
usercmd_t cmd; // we would lose angles if not persistant
qboolean localClient; // true if "ip" info key is "localhost"
@ -1103,6 +1107,7 @@ extern vmCvar_t RQ3_team2;
//aasimon: Ref System for MM
extern vmCvar_t g_RQ3_AllowRef;
extern vmCvar_t g_RQ3_RefPass;
extern vmCvar_t g_RQ3_RefID;
void trap_Printf( const char *fmt );
void trap_Error( const char *fmt );

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.27 2002/03/07 01:38:36 assimon
// Changed Ref System. New cvar added - g_RQ3_RefID. Now referee is peserved even on map changes or map_restarts.
//
// Revision 1.26 2002/03/07 00:00:54 assimon
// Added a skeleton referee suport, with some functional commands (map_restart and kick)
//
@ -142,6 +145,7 @@ vmCvar_t RQ3_team2;
// aasimon: Ref System for MM
vmCvar_t g_RQ3_AllowRef;
vmCvar_t g_RQ3_RefPass;
vmCvar_t g_RQ3_RefID;
#ifdef MISSIONPACK
vmCvar_t g_obeliskHealth;
@ -269,9 +273,10 @@ static cvarTable_t gameCvarTable[] = {
//Slicer: Team Status Cvars for MM
{ &RQ3_team1, "RQ3_team1", "0", CVAR_SYSTEMINFO, 0, qfalse},
{ &RQ3_team2, "RQ3_team2", "0", CVAR_SYSTEMINFO, 0, qfalse},
// aasimon: Ref system for MM
// aasimon: Ref system for MM,added infor for referee id (clientnumber)
{ &g_RQ3_AllowRef, "g_RQ3_AllowRef", "0", CVAR_SERVERINFO, 0, qtrue},
{ &g_RQ3_RefPass, "g_RQ3_RefPassword", "", CVAR_USERINFO, 0, qfalse}
{ &g_RQ3_RefPass, "g_RQ3_RefPassword", "", CVAR_USERINFO, 0, qfalse},
{ &g_RQ3_RefID, "g_RQ3_RefID", "-1", CVAR_SYSTEMINFO | CVAR_ROM, 0, qfalse}
};

View file

@ -145,7 +145,12 @@ void MM_ClearScores ( void ){
// aasimon: checks for a ref
qboolean Ref_Exists( void ){
gentity_t *ent;
if (g_RQ3_RefID.integer == -1)
return qfalse;
else
return qtrue;
/* gentity_t *ent;
int i;
for (i = 0; i < level.maxclients; i++) {
ent = &g_entities[i];
@ -155,13 +160,17 @@ qboolean Ref_Exists( void ){
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];
int cn;
char teste[2];
if ( !g_RQ3_AllowRef.integer ){
// No ref allowed on the server - HELLO!!!!! FIREMAN CARS????
@ -176,7 +185,9 @@ qboolean Ref_Auth( gentity_t *ent ){
if ( Ref_Exists() ){
// One ref per match
if ( ent->client->pers.referee ){
cn = ent-g_entities;
if ( cn == g_RQ3_RefID.integer){
trap_SendServerCommand ( ent-g_entities, "print \"You are already the referee\n\"" );
return qfalse;
}
@ -191,7 +202,9 @@ qboolean Ref_Auth( gentity_t *ent ){
// Does a simple plain text auth
if ( Q_stricmp (pass, g_RQ3_RefPass.string) == 0) {
ent->client->pers.referee = qtrue;
cn = ent-g_entities;
Com_sprintf(teste, 3, "%i", cn);
trap_Cvar_Set("g_RQ3_RefID", teste);
trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " is the new Referee\n\"", ent->client->pers.netname) );
return qtrue;
}
@ -208,7 +221,8 @@ void Ref_Command ( gentity_t *ent){
char com[MAX_TOKEN_CHARS];
int cn;
if (!ent->client->pers.referee) {
cn = ent-g_entities;
if (cn != g_RQ3_RefID.integer) {
trap_SendServerCommand( ent-g_entities, "print \"You are not a referee\n\"" );
return;
}
@ -257,11 +271,11 @@ void Ref_Command ( gentity_t *ent){
}
void Ref_Resign ( gentity_t *ent ){
if (!ent->client->pers.referee) {
if (ent-g_entities != g_RQ3_RefID.integer) {
trap_SendServerCommand( ent-g_entities, "print \"You are not a referee\n\"" );
return;
}
ent->client->pers.referee = qfalse;
trap_Cvar_Set("g_RQ3_RefID", "-1");
trap_SendServerCommand ( ent-g_entities, "print \"You resign from your referee status\n\"");
}