Esempio n. 1
0
// *** Match Restart ***
int G_MatchReset_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		if (!vote_allow_matchreset.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			return G_INVALID;
		}
		else if (trap_Argc() != 2 && G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			return G_INVALID;
		}
		// Vote action (vote has passed)
	}
	else
	{
		// Restart the map back to warmup
		Svcmd_ResetMatch_f(qtrue, qtrue);
		AP("cp \"^1*** Match Reset! ***\n\"");
	}

	return G_OK;
}
Esempio n. 2
0
// *** Timelimit ***
int G_Timelimit_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if(arg) {
		if(!vote_allow_timelimit.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			G_voteCurrentSetting(ent, arg, g_timelimit.string);
			return(G_INVALID);
		} else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) {
			G_voteCurrentSetting(ent, arg, g_timelimit.string);
			return(G_INVALID);
		} else if(atoi(arg2) < 0) {
			G_refPrintf(ent, "Sorry, can't specify a timelimit < 0!");
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);

	// Vote action (vote has passed)
	} else {
		// Timelimit change
		G_voteSetVoteString("Timelimit");
	}

	return(G_OK);
}
Esempio n. 3
0
// *** Campaign - simpleton: we dont verify map is allowed/exists ***
int G_Campaign_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if(arg) {
		char serverinfo[MAX_INFO_STRING];
		trap_GetServerinfo(serverinfo, sizeof(serverinfo));

		if(!vote_allow_map.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			if( g_gametype.integer == GT_WOLF_CAMPAIGN ) {
				G_voteCurrentSetting(ent, arg, g_campaigns[level.currentCampaign].shortname );
			}
			return(G_INVALID);
		} else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) {
			if( g_gametype.integer == GT_WOLF_CAMPAIGN ) {
				G_voteCurrentSetting(ent, arg, g_campaigns[level.currentCampaign].shortname );
			}
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);

	// Vote action (vote has passed)
	} else {
		char s[MAX_STRING_CHARS];

		trap_Cvar_VariableStringBuffer("nextcampaign", s, sizeof(s));
		trap_SendConsoleCommand(EXEC_APPEND, va("campaign %s%s\n", level.voteInfo.vote_value, ((*s) ? va("; set nextcampaign \"%s\"", s) : "")));
	}

	return(G_OK);
}
Esempio n. 4
0
// *** Match Restart ***
int G_MatchReset_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if(arg) {
		if(!vote_allow_matchreset.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			return(G_INVALID);
		} else if( trap_Argc() != 2 && G_voteDescription(ent, fRefereeCmd, dwVoteIndex) ) {
			return(G_INVALID);
//		} else if(trap_Argc() > 2) {
//			if(!Q_stricmp(arg2, "?")) {
//				G_refPrintf(ent, "Usage: ^3%s %s%s\n", ((fRefereeCmd) ? "\\ref" : "\\callvote"), arg, aVoteInfo[dwVoteIndex].pszVoteHelp);
//				return(G_INVALID);
//			}
		}

	// Vote action (vote has passed)
	} else {
		// Restart the map back to warmup
		Svcmd_ResetMatch_f(qtrue, qtrue);
		AP("cp \"^1*** Match Reset! ***\n\"");
	}

	return(G_OK);
}
Esempio n. 5
0
// Vote toggling
int G_voteProcessOnOff(gentity_t *ent, char *arg, char *arg2, qboolean fRefereeCmd, int curr_setting, int vote_allow, int vote_type)
{
	if (!vote_allow && ent && !ent->client->sess.referee)
	{
		G_voteDisableMessage(ent, aVoteInfo[vote_type].pszVoteName);
		G_voteCurrentSetting(ent, aVoteInfo[vote_type].pszVoteName, ((curr_setting) ? ENABLED : DISABLED));
		return(G_INVALID);
	}
	if (G_voteDescription(ent, fRefereeCmd, vote_type))
	{
		G_voteCurrentSetting(ent, aVoteInfo[vote_type].pszVoteName, ((curr_setting) ? ENABLED : DISABLED));
		return(G_INVALID);
	}

	if ((atoi(arg2) && curr_setting) || (!atoi(arg2) && !curr_setting))
	{
		G_refPrintf(ent, "^3%s^5 is already %s!", aVoteInfo[vote_type].pszVoteName, ((curr_setting) ? ENABLED : DISABLED));
		return(G_INVALID);
	}

	Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);
	Com_sprintf(arg2, VOTE_MAXSTRING, "%s", (atoi(arg2)) ? ACTIVATED : DEACTIVATED);

	return(G_OK);
}
Esempio n. 6
0
File: g_vote.c Progetto: ETrun/ETrun
// *** Map - simpleton: we dont verify map is allowed/exists ***
int G_Map_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd) {
	// Vote request (vote is being initiated)
	if (arg) {
		char serverinfo[MAX_INFO_STRING];
		trap_GetServerinfo(serverinfo, sizeof (serverinfo));

		if (!vote_allow_map.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			G_voteCurrentSetting(ent, arg, Info_ValueForKey(serverinfo, "mapname"));
			return G_INVALID;
		} else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) {
			G_voteCurrentSetting(ent, arg, Info_ValueForKey(serverinfo, "mapname"));
			return G_INVALID;
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);

		// Vote action (vote has passed)
	} else {
		// Nico, delay the map change
		G_delay_map_change(level.voteInfo.vote_value, 0);
	}

	return G_OK;
}
Esempio n. 7
0
// *** Player Un-Mute ***
int G_UnMute_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	if (fRefereeCmd)
	{
		// handled elsewhere
		return G_NOTFOUND;
	}

	// Vote request (vote is being initiated)
	if (arg)
	{
		int pid;

		if (!vote_allow_muting.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			return G_INVALID;
		}
		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.muted)
		{
			G_refPrintf(ent, "Player is not muted!");
			return G_INVALID;
		}

		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
	{
		int pid = atoi(level.voteInfo.vote_value);

		// Mute a player
		if (level.clients[pid].sess.referee != RL_RCON)
		{
			trap_SendServerCommand(pid, va("cpm \"^3You have been un-muted\""));
			level.clients[pid].sess.muted = qfalse;
			AP(va("cp \"%s\n^3has been un-muted!\n\"", level.clients[pid].pers.netname));
			ClientUserinfoChanged(pid);
		}
		else
		{
			G_Printf("Cannot un-mute a referee.\n");
		}
	}

	return G_OK;
}
Esempio n. 8
0
// *** Player Kick ***
int G_Kick_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_kick.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			return G_INVALID;
		}
		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, "Can't vote to kick referees!");
			return G_INVALID;
		}

		if (g_entities[pid].r.svFlags & SVF_BOT)
		{
			G_refPrintf(ent, "Can't vote to kick bots!");
			return G_INVALID;
		}

		if (!fRefereeCmd && ent)
		{
			if (level.clients[pid].sess.sessionTeam != TEAM_SPECTATOR && level.clients[pid].sess.sessionTeam != ent->client->sess.sessionTeam)
			{
				G_refPrintf(ent, "Can't vote to kick players on opposing team!");
				return G_INVALID;
			}
		}

		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
	{
		// Kick a player
		trap_SendConsoleCommand(EXEC_APPEND, va("clientkick %d\n", atoi(level.voteInfo.vote_value)));
		AP(va("cp \"%s\n^3has been kicked!\n\"", level.clients[atoi(level.voteInfo.vote_value)].pers.netname));
	}

	return G_OK;
}
Esempio n. 9
0
// *** 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);
}
Esempio n. 10
0
// *** Player Kick ***
int G_Kick_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_kick.integer && ent && !ent->client->sess.referee ) {
			G_voteDisableMessage(ent, arg);
			return G_INVALID;
		} 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, "Can't vote to kick referees!" );
			return G_INVALID;
		}

		if(G_shrubbot_permission(&g_entities[pid], SBF_IMMUNITY)) {
			G_refPrintf( ent, "Can't vote to kick admins!" );
			return G_INVALID;
		}

		// pheno: prevent ettv slaves from being callvote kicked 
		if( level.clients[pid].sess.ettv &&
			( g_ettvFlags.integer & ETTV_IMMUNITY ) ) {
			G_refPrintf( ent, "Can't vote to kick ettv slaves!" );
			return G_INVALID;
		}

		if( !fRefereeCmd && ent ) {
			if( level.clients[ pid ].sess.sessionTeam != TEAM_SPECTATOR && level.clients[ pid ].sess.sessionTeam != ent->client->sess.sessionTeam ) {
				G_refPrintf( ent, "Can't vote to kick players on opposing team!" );
				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 {
		// Kick a player
		//trap_SendConsoleCommand( EXEC_APPEND, va( "clientkick %d\n", atoi( level.voteInfo.vote_value ) ) );
		// tjw: clientkick doesn't work in 2.60
		trap_DropClient(atoi(level.voteInfo.vote_value),
			"You have been kicked", 120);

		AP( va( "cp \"%s\n^3has been kicked!\n\"", level.clients[ atoi( level.voteInfo.vote_value ) ].pers.netname ) );
	}

	return G_OK;
}
Esempio n. 11
0
// *** Player PutSpec ***
int G_PutSpec_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// yada - my ass... this isnt handled elsewhere at all
	//if( fRefereeCmd ){
	//	// handled elsewhere
	//	return(G_NOTFOUND);
	//}

	// Vote request (vote is being initiated)
	if(arg) {
		int pid;

		if(!vote_allow_putspec.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			return(G_INVALID);
		} 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, "Can't vote to PutSpec referees!");
			return(G_INVALID);
		}

		if(G_shrubbot_permission(&g_entities[pid], SBF_IMMUNITY)) {
			G_refPrintf( ent, "Can't vote to PutSpec admins!" );
			return G_INVALID;
		}

		if(level.clients[pid].sess.sessionTeam == TEAM_SPECTATOR ||
			level.clients[pid].sess.sessionTeam != ent->client->sess.sessionTeam) {
			G_refPrintf(ent, "You can only PutSpec players in your own team!");
			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 {
		int pid = atoi(level.voteInfo.vote_value);

		SetTeam( &g_entities[pid], "s", qtrue, -1, -1, qfalse );
		trap_SendServerCommand( pid, va( "cpm \"^3You have been moved to the Spectators\"") );
		AP(va("cp \"%s ^3has been\nmoved to the Spectators!\n\"", level.clients[pid].pers.netname));
		ClientUserinfoChanged( pid );
		
		if(g_gamestate.integer == GS_WARMUP || g_gamestate.integer == GS_WARMUP_COUNTDOWN) {
			G_readyMatchState();
		}
	}

	return(G_OK);
}
Esempio n. 12
0
// *** GameType ***
int G_Gametype_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		int i = atoi(arg2);

		if (!vote_allow_gametype.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			G_GametypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", g_gametype.integer, gameNames[g_gametype.integer]));
			return G_INVALID;
		}
		else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			G_GametypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", g_gametype.integer, gameNames[g_gametype.integer]));
			return G_INVALID;
		}

		if (i < GT_WOLF || i >= GT_MAX_GAME_TYPE || i == GT_WOLF_CAMPAIGN)
		{
			G_refPrintf(ent, "\n^3Invalid gametype: ^7%d", i);
			G_GametypeList(ent);
			return G_INVALID;
		}

		if (i == g_gametype.integer)
		{
			G_refPrintf(ent, "\n^3Gametype^5 is already set to %s!", gameNames[i]);
			return G_INVALID;
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s", gameNames[i]);

		// Vote action (vote has passed)
	}
	else
	{
		char s[MAX_STRING_CHARS];

		// Set gametype
		G_voteSetValue("Gametype", "g_gametype");

		trap_Cvar_VariableStringBuffer("mapname", s, sizeof(s));
		trap_SendConsoleCommand(EXEC_APPEND, va("map %s\n", s));
	}

	return G_OK;
}
Esempio n. 13
0
// *** Map - simpleton: we dont verify map is allowed/exists ***
int G_Map_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if(arg) {
		char serverinfo[MAX_INFO_STRING];
		trap_GetServerinfo(serverinfo, sizeof(serverinfo));

		if(!vote_allow_map.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			G_voteCurrentSetting(ent, arg, Info_ValueForKey(serverinfo, "mapname"));
			return(G_INVALID);
		} else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) {
			G_voteCurrentSetting(ent, arg, Info_ValueForKey(serverinfo, "mapname"));
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);

	// Vote action (vote has passed)
	} else {
		int i;
		char s[MAX_STRING_CHARS];

		if(!level.intermissiontime){
			if(g_XPSave.integer &  XPSF_STORE_AT_RESTART){
				for( i = 0; i < level.numConnectedClients; i++ ) {
					G_xpsave_add(&g_entities[level.sortedClients[i]],qfalse);
				}
				if(g_spreeOptions.integer & SPREE_SAVE_RECORD_RESTART){
					G_AddSpreeRecord();
				}
				G_xpsave_writeconfig();
			}else if(g_spreeOptions.integer & SPREE_SAVE_RECORD_RESTART){
				G_xpsave_readconfig();
				G_AddSpreeRecord();
				G_xpsave_writeconfig();
			}	
		}
		G_reset_disconnects();

		if( g_gametype.integer == GT_WOLF_CAMPAIGN ) {
			trap_Cvar_VariableStringBuffer("nextcampaign", s, sizeof(s));
			trap_SendConsoleCommand(EXEC_APPEND, va("campaign %s%s\n", level.voteInfo.vote_value, ((*s) ? va("; set nextcampaign \"%s\"", s) : "")));
		} else {
			Svcmd_ResetMatch_f(qtrue, qfalse);
			trap_Cvar_VariableStringBuffer("nextmap", s, sizeof(s));
			trap_SendConsoleCommand(EXEC_APPEND, va("map %s%s\n", level.voteInfo.vote_value, ((*s) ? va("; set nextmap \"%s\"", s) : "")));
		}
	}

	return(G_OK);
}
Esempio n. 14
0
// *** Player Mute ***
int G_Mute_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// yada - no its handled here now
	//if( fRefereeCmd )
	//	// handled elsewhere
	//	return(G_NOTFOUND);

	// Vote request (vote is being initiated)
	if(arg) {
		int pid;

		if(!vote_allow_muting.integer && ent && !ent->client->sess.referee) {
			G_voteDisableMessage(ent, arg);
			return(G_INVALID);
		} 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, "Can't vote to mute referees!");
			return(G_INVALID);
		}

		if(G_shrubbot_permission(&g_entities[pid], SBF_IMMUNITY)) {
			G_refPrintf( ent, "Can't vote to mute admins!" );
			return G_INVALID;
		}

		if(level.clients[pid].sess.auto_unmute_time != 0) {
			G_refPrintf(ent, "Player is already muted!");
			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 {
		int pid = atoi(level.voteInfo.vote_value);

		// Mute a player
		if( level.clients[pid].sess.referee != RL_RCON ) {
			trap_SendServerCommand( pid, va( "cpm \"^3You have been muted\"") );
			level.clients[pid].sess.auto_unmute_time = -1;
			AP(va("cp \"%s\n^3has been muted!\n\"", level.clients[pid].pers.netname));
			ClientUserinfoChanged( pid );
		} else {
			G_Printf( "Cannot mute a referee.\n" );
		}
	}

	return(G_OK);
}
Esempio n. 15
0
// *** Warmup Weapon Fire ***
int G_Warmupfire_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		int i = atoi(arg2), val = (match_warmupDamage.integer < 0) ? 0 :
		                          (match_warmupDamage.integer > 2) ? 2 :
		                          match_warmupDamage.integer;

		if (!vote_allow_warmupdamage.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			G_WarmupDamageTypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", val, warmupType[val]));
			return(G_INVALID);
		}
		else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			G_WarmupDamageTypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", val, warmupType[val]));
			return(G_INVALID);
		}

		if (i < 0 || i > 2)
		{
			G_refPrintf(ent, "\n^3Invalid Warmup Damage type: ^7%d", i);
			G_WarmupDamageTypeList(ent);
			return(G_INVALID);
		}

		if (i == val)
		{
			G_refPrintf(ent, "\n^3Warmup Damage^5 is already set to %s!", warmupType[i]);
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s", warmupType[i]);


		// Vote action (vote has passed)
	}
	else
	{
		// Warmup damage setting
		AP(va("print \"^3Warmup Damage set to: ^5%s\n\"", warmupType[atoi(level.voteInfo.vote_value)]));
		trap_SendConsoleCommand(EXEC_APPEND, va("match_warmupDamage %s\n", level.voteInfo.vote_value));
	}

	return(G_OK);
}
Esempio n. 16
0
// *** 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 );
}
Esempio n. 17
0
// *** GameType ***
int G_Gametype_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		int i = atoi(arg2);

		if (!vote_allow_gametype.integer && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			G_GametypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", g_gametype.integer, gameNames[g_gametype.integer]));
			return(G_INVALID);
		}
		else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			G_GametypeList(ent);
			G_voteCurrentSetting(ent, arg, va("%d (%s)", g_gametype.integer, gameNames[g_gametype.integer]));
			return(G_INVALID);
		}

		if (i < GT_WOLF || i >= GT_MAX_GAME_TYPE || i == GT_WOLF_CAMPAIGN)
		{
			G_refPrintf(ent, "\n^3Invalid gametype: ^7%d", i);
			G_GametypeList(ent);
			return(G_INVALID);
		}

		if (i == g_gametype.integer)
		{
			G_refPrintf(ent, "\n^3Gametype^5 is already set to %s!", gameNames[i]);
			return(G_INVALID);
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);
		Com_sprintf(arg2, VOTE_MAXSTRING, "%s", gameNames[i]);

		// Vote action (vote has passed)
	}
	else
	{
		// Set gametype
		G_voteSetValue("Gametype", "g_gametype");
		Svcmd_ResetMatch_f(qtrue, qtrue);
	}

	return(G_OK);
}
Esempio n. 18
0
int G_Config_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
	// Vote request (vote is being initiated)
	if (arg)
	{
		if (vote_allow_config.integer <= 0 && ent && !ent->client->sess.referee)
		{
			G_voteDisableMessage(ent, arg);
			return G_INVALID;
		}
		else if (trap_Argc() > 3)
		{
			G_refPrintf(ent, "Usage: ^3%s %s%s\n", ((fRefereeCmd) ? "\\ref" : "\\callvote"), arg, aVoteInfo[dwVoteIndex].pszVoteHelp);
			G_PrintConfigs(ent);
			return G_INVALID;
		}
		else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
		{
			G_PrintConfigs(ent);
			return G_INVALID;
		}
		else if (arg2 == NULL || strlen(arg2) < 1)
		{
			G_PrintConfigs(ent);
			return G_INVALID;
		}

		if (!G_isValidConfig(ent, arg2))
		{
			return G_INVALID;
		}

		Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%s", arg2);
	}
	else // Vote action (vote has passed)
	{
		// Load in comp settings for current gametype
		if (G_configSet(level.voteInfo.vote_value))
		{
			AP("cpm \"Competition Settings Loaded!\n\"");
		}
	}

	return G_OK;
}