// *** Un-Referee voting *** int G_Unreferee_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd) { // Vote request (vote is being initiated) if(arg) { int pid; if(!vote_allow_referee.integer && ent && !ent->client->sess.referee) { G_voteDisableMessage(ent, arg); return(G_INVALID); } // yada - ent==NULL for console... if( (!ent || ent->client->sess.referee) && trap_Argc() == 2) { G_playersMessage(ent); return(G_INVALID); } else if(ent && trap_Argc() == 2) pid = ent - g_entities; // yada - ent still NULL for console... else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) return(G_INVALID); else if((pid = ClientNumberFromString(ent, arg2)) == -1) return(G_INVALID); if(level.clients[pid].sess.referee == RL_NONE) { G_refPrintf(ent, "[lof]%s [lon]isn't a referee!", level.clients[pid].pers.netname); return(G_INVALID); } if(level.clients[pid].sess.referee == RL_RCON) { G_refPrintf(ent, "[lof]%s's [lon]status cannot be removed", level.clients[pid].pers.netname); return(G_INVALID); } if( level.clients[pid].pers.localClient ) { G_refPrintf(ent, "[lof]%s [lon]^7is the Server Host", level.clients[pid].pers.netname); return(G_INVALID); } Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid); Com_sprintf(arg2, VOTE_MAXSTRING, "%s^7", level.clients[pid].pers.netname); // Vote action (vote has passed) } else { // Stripping of referee status gclient_t *cl = &level.clients[atoi(level.voteInfo.vote_value)]; cl->sess.referee = RL_NONE; if( !cl->sess.shoutcaster ) { // don't remove shoutcaster's invitation cl->sess.spec_invite = 0; } AP(va("cp \"%s^7\nis no longer a referee\n\"", cl->pers.netname)); ClientUserinfoChanged( atoi(level.voteInfo.vote_value) ); } return(G_OK); }
// *** Referee voting *** int G_Referee_v( gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd ) { // Vote request (vote is being initiated) if ( arg ) { int pid; if ( !vote_allow_referee.integer && ent && !ent->client->sess.referee ) { G_voteDisableMessage( ent, arg ); return( G_INVALID ); } if ( !ent->client->sess.referee && level.numPlayingClients < 3 ) { G_refPrintf( ent, "Sorry, not enough clients in the game to vote for a referee" ); return( G_INVALID ); } if ( ent->client->sess.referee && trap_Argc() == 2 ) { G_playersMessage( ent ); return( G_INVALID ); } else if ( trap_Argc() == 2 ) { pid = ent - g_entities; } else if ( G_voteDescription( ent, fRefereeCmd, dwVoteIndex ) ) { return( G_INVALID ); } else if ( ( pid = ClientNumberFromString( ent, arg2 ) ) == -1 ) { return( G_INVALID ); } if ( level.clients[pid].sess.referee ) { G_refPrintf( ent, "[lof]%s [lon]is already a referee!", level.clients[pid].pers.netname ); return( -1 ); } Com_sprintf( level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid ); Com_sprintf( arg2, VOTE_MAXSTRING, "%s", level.clients[pid].pers.netname ); // Vote action (vote has passed) } else { // Voting in a new referee gclient_t *cl = &level.clients[atoi( level.voteInfo.vote_value )]; if ( cl->pers.connected == CON_DISCONNECTED ) { AP( "print \"Player left before becoming referee\n\"" ); } else { cl->sess.referee = RL_REFEREE; // FIXME: Differentiate voted refs from passworded refs cl->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES; AP( va( "cp \"%s^7 is now a referee\n\"", cl->pers.netname ) ); ClientUserinfoChanged( atoi( level.voteInfo.vote_value ) ); } } return( G_OK ); }