Exemplo n.º 1
0
void vote_check_antilag ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_ANTILAG ) )
		return;

	veto = is_admins_vote( OV_ANTILAG );

	if( veto || !get_votes_req( OV_ANTILAG, true ) )
	{
		vote_clear( OV_ANTILAG );

		// toggle antilag mode.
		trap_cvar_set_float( "sv_antilag", (float)(cvar( "sv_antilag" ) ? 0 : 2));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by admin veto", OnOff(2 == cvar("sv_antilag")))));
		else
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by majority vote", OnOff(2 == cvar("sv_antilag")))));

		return;
	}
}
Exemplo n.º 2
0
// { votecoop
void vote_check_coop ()
{
	int veto;

	if ( ( deathmatch && match_in_progress ) || intermission_running || match_over )
		return;

	if ( !get_votes( OV_COOP ) )
		return;

	veto = is_admins_vote( OV_COOP );

	if( veto || !get_votes_req( OV_COOP, true ) )
	{
		vote_clear( OV_COOP );

		// toggle coop mode
		cvar_fset( "coop", coop = !cvar("coop") );
		// set appropriate deathmatch
		cvar_fset( "deathmatch", deathmatch = !coop );

		if ( veto )
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by admin veto", OnOff(cvar("coop")))) );
		else
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by majority vote", OnOff(cvar("coop")))) );

		// and reload map
		if ( cvar("k_bloodfest") )
			changelevel( coop ? g_globalvars.mapname : cvar_string( "k_defmap" ) );
		else
			changelevel( coop ? "start" : g_globalvars.mapname );
			
		return;
	}
}
Exemplo n.º 3
0
// !!! do not confuse rpickup and pickup
void vote_check_pickup ()
{
	gedict_t *p;
	int veto;

	if ( match_in_progress || k_captains )
		return;

	if ( !get_votes( OV_PICKUP ) )
		return;

	veto = is_admins_vote( OV_PICKUP );

	if( veto || !get_votes_req( OV_PICKUP, true ) ) {
		vote_clear( OV_PICKUP );

		if ( veto )
			G_bprint(2, "console: admin veto for pickup\n");
		else
			G_bprint(2, "console: a pickup game it is then\n");

		for( p = world;	(p = find_plr( p )); ) {

			stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO,
						"break\n"
						"color 0\n"
						"team \"\"\n"
						"skin base\n");
		}

		return;
	}
}
Exemplo n.º 4
0
Arquivo: vote.c Projeto: deurk/ktx
void vote_check_teamoverlay ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_TEAMOVERLAY ) )
		return;

	veto = is_admins_vote( OV_TEAMOVERLAY );

	if( veto || !get_votes_req( OV_TEAMOVERLAY, true ) )
	{
		vote_clear( OV_TEAMOVERLAY );

		// Toggle teamoverlay.
		cvar_fset("k_teamoverlay", !cvar("k_teamoverlay"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by admin veto", OnOff(cvar("k_teamoverlay")))));
		else
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by majority vote", OnOff(cvar("k_teamoverlay")))));

		return;
	}
}
Exemplo n.º 5
0
// !!! do not confuse rpickup and pickup
void vote_check_rpickup ()
{
	float frnd;
    int i, tn, pl_cnt, pl_idx;
	gedict_t *p;
	int veto;

	if ( match_in_progress || k_captains )
		return;

	if ( !get_votes( OV_RPICKUP ) )
		return;

   	// Firstly obtain the number of players we have in total on server
   	pl_cnt = CountPlayers();

	if ( pl_cnt < 4 )
		return;

	veto = is_admins_vote( OV_RPICKUP );

	if( veto || !get_votes_req( OV_RPICKUP, true ) ) {
		vote_clear( OV_RPICKUP );

		for( p = world; (p = find_plr( p )); )
			p->k_teamnumber = 0;

		for( tn = 1; pl_cnt > 0; pl_cnt-- ) {
			frnd = g_random(); // bound is macros - so u _can't_ put g_random inside bound
			pl_idx = bound(0, (int)( frnd * pl_cnt ), pl_cnt-1 ); // select random player between 0 and pl_cnt

			for( i = 0, p = world; (p = find_plr( p )); ) {
				if ( p->k_teamnumber )
					continue;

				if ( i == pl_idx ) {
					p->k_teamnumber = tn;
					tn = (tn == 1 ? 2 : 1); // next random player will be in other team

            		if( p->k_teamnumber == 1 )
                		stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "break\ncolor  4\nskin \"\"\nteam red\n");
            		else
                		stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "break\ncolor 13\nskin \"\"\nteam blue\n");

					break;
				}

				i++;
			}
		}

		if ( veto )
			G_bprint(2, "console: admin veto for %s\n", redtext("random pickup"));
		else
    		G_bprint(2, "console: %s game it is then\n", redtext("random pickup"));

		return;
	}
}
Exemplo n.º 6
0
void vote_check_nospecs ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_NOSPECS ) )
		return;

	veto = is_admins_vote( OV_NOSPECS );

	if( veto || !get_votes_req( OV_NOSPECS, true ) )
	{
		vote_clear( OV_NOSPECS );

		// set no specs mode
		cvar_fset("_k_nospecs", !cvar("_k_nospecs"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by admin veto", OnOff(cvar("_k_nospecs")))));
		else
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by majority vote", OnOff(cvar("_k_nospecs")))));

		// kick specs
		if ( cvar("_k_nospecs") )
		{
			gedict_t *spec;

			for ( spec = world; (spec = find_spc( spec )); )
			{
				if ( VIP( spec ) & ALLOWED_NOSPECS_VIPS )
					continue; // don't kick this VIP
    
				if ( is_real_adm(spec) )
					continue; // don't kick real admin
    
				stuffcmd(spec, "disconnect\n");  // FIXME: stupid way
			}
		}

		return;
	}
}