Ejemplo n.º 1
0
// ************** READY / NOTREADY
//
// Sets a player's "ready" status.
void G_ready_cmd(gentity_t * ent, unsigned int dwCommand, qboolean state)
{
	char           *status[2] = { " NOT", "" };

	if(g_gamestate.integer == GS_PLAYING || g_gamestate.integer == GS_INTERMISSION)
	{
		CP("cpm \"Match is already in progress!\n\"");
		return;
	}

	if(!state && g_gamestate.integer == GS_WARMUP_COUNTDOWN)
	{
		CP("cpm \"Countdown started.... ^3notready^7 ignored!\n\"");
		return;
	}

	if(ent->client->sess.sessionTeam == TEAM_SPECTATOR)
	{
		CP("cpm \"You must be in the game to be ^3ready^7!\n\"");
		return;
	}

	// Can't ready until enough players.
	if(level.numPlayingClients < match_minplayers.integer)
	{
		CP("cpm \"Not enough players to start match!\n\"");
		return;
	}

	if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName))
	{
		return;
	}

	// Move them to correct ready state
	if(ent->client->pers.ready == state)
	{
		CP(va("print \"You are already%s ready!\n\"", status[state]));
	}
	else
	{
		ent->client->pers.ready = state;
		if(!level.intermissiontime)
		{
			if(state)
			{
				G_MakeReady(ent);
			}
			else
			{
				G_MakeUnready(ent);
			}

			AP(va("print \"%s^7 is%s ready!\n\"", ent->client->pers.netname, status[state]));
			AP(va("cp \"\n%s\n^3is%s ready!\n\"", ent->client->pers.netname, status[state]));
		}
	}

	G_readyMatchState();
}
Ejemplo n.º 2
0
// ************** SPECINVITE
//
// Sends an invitation to a player to spectate a team.
void G_specinvite_cmd(gentity_t * ent, unsigned int dwCommand, qboolean fLock)
{
	int             tteam, pid;
	gentity_t      *player;
	char            arg[MAX_TOKEN_CHARS];

	if(team_nocontrols.integer)
	{
		G_noTeamControls(ent);
		return;
	}
	if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName))
	{
		return;
	}

	tteam = G_teamID(ent);
	if(tteam == TEAM_AXIS || tteam == TEAM_ALLIES)
	{
		if(!teamInfo[tteam].spec_lock)
		{
			CP("cpm \"Your team isn't locked from spectators!\n\"");
			return;
		}

		// Find the player to invite.
		trap_Argv(1, arg, sizeof(arg));
		if((pid = ClientNumberFromString(ent, arg)) == -1)
		{
			return;
		}

		player = g_entities + pid;

		// Can't invite self
		if(player->client == ent->client)
		{
			CP("cpm \"You can't specinvite yourself!\n\"");
			return;
		}

		// Can't invite an active player.
		if(player->client->sess.sessionTeam != TEAM_SPECTATOR)
		{
			CP("cpm \"You can't specinvite a non-spectator!\n\"");
			return;
		}

		player->client->sess.spec_invite |= tteam;

		// Notify sender/recipient
		CP(va("print \"%s^7 has been sent a spectator invitation.\n\"", player->client->pers.netname));
		G_printFull(va("*** You've been invited to spectate the %s team!", aTeams[tteam]), player);

	}
	else
	{
		CP("cpm \"Spectators can't specinvite players!\n\"");
	}
}
Ejemplo n.º 3
0
// ************** LOCK / UNLOCK
//
// Locks/unlocks a player's team.
void G_lock_cmd(gentity_t * ent, unsigned int dwCommand, qboolean fLock)
{
	int             tteam;

	if(team_nocontrols.integer)
	{
		G_noTeamControls(ent);
		return;
	}
	if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName))
	{
		return;
	}

	tteam = G_teamID(ent);
	if(tteam == TEAM_AXIS || tteam == TEAM_ALLIES)
	{
		if(teamInfo[tteam].team_lock == fLock)
		{
			CP(va("print \"^3Your team is already %sed!\n\"", lock_status[fLock]));
		}
		else
		{
			char           *info = va("\"The %s team is now %sed!\n\"", aTeams[tteam], lock_status[fLock]);

			teamInfo[tteam].team_lock = fLock;
			AP(va("print %s", info));
			AP(va("cp %s", info));
		}
	}
	else
	{
		CP(va("print \"Spectators can't %s a team!\n\"", lock_status[fLock]));
	}
}
Ejemplo n.º 4
0
// ************** SPECLOCK / SPECUNLOCK
//
// Locks/unlocks a player's team from spectators.
void G_speclock_cmd( gentity_t *ent, unsigned int dwCommand, qboolean fLock ) {
	int tteam;

	if ( team_nocontrols.integer ) {
		G_noTeamControls( ent );
		return;
	}

	if ( !G_cmdDebounce( ent, aCommandInfo[dwCommand].pszCommandName ) ) {
		return;
	}

	tteam = G_teamID( ent );
	if ( tteam == TEAM_AXIS || tteam == TEAM_ALLIES ) {
		if ( teamInfo[tteam].spec_lock == fLock ) {
			CP( va( "print \"\n^3Your team is already %sed from spectators!\n\n\"", lock_status[fLock] ) );
		} else {
			G_printFull( va( "The %s team is now %sed from spectators", aTeams[tteam], lock_status[fLock] ), NULL );
			G_updateSpecLock( tteam, fLock );
			if ( fLock ) {
				CP( "cpm \"Use ^3specinvite^7 to invite people to spectate.\n\"" );
			}
		}
	} else {
		CP( va( "print \"Spectators can't %s a team from spectators!\n\"", lock_status[fLock] ) );
	}
}
Ejemplo n.º 5
0
// Pause/unpause a match.
void G_refPause_cmd(gentity_t *ent, qboolean fPause)
{
	char *status[2] = { "^5UN", "^1" };
	char *referee = (ent) ? "Referee" : "ref";

	if((PAUSE_UNPAUSING >= level.match_pause && !fPause) || (PAUSE_NONE != level.match_pause && fPause)) {
		// CHRUKER: b047 - Remove unneeded \" and linebreak
		G_refPrintf(ent, "The match is already %sPAUSED!", status[fPause]);
		return;
	}

	if(ent && !G_cmdDebounce(ent, ((fPause)?"pause":"unpause"))) return;

	// Trigger the auto-handling of pauses
	if(fPause) {
		level.match_pause = 100 + ((ent) ? (1 + ent - g_entities) : 0);
		G_globalSound("sound/misc/referee.wav");
		G_spawnPrintf(DP_PAUSEINFO, level.time + 15000, NULL);
		AP(va("print \"^3%s ^1PAUSED^3 the match^3!\n", referee));
		// CHRUKER: b047 - Remove unneeded \" and linebreak
		CP(va("cp \"^3Match is ^1PAUSED^3! (^7%s^3)", referee));
		level.server_settings |= CV_SVS_PAUSE;
		trap_SetConfigstring(CS_SERVERTOGGLES, va("%d", level.server_settings));
	} else {
		AP(va("print \"\n^3%s ^5UNPAUSES^3 the match ... resuming in 10 seconds!\n\n\"", referee));
		level.match_pause = PAUSE_UNPAUSING;
		G_globalSound("sound/osp/prepare.wav");
		G_spawnPrintf(DP_UNPAUSING, level.time + 10, NULL);
		return;
	}
}
Ejemplo n.º 6
0
// ************** TEAMREADY
//
// Sets a player's team "ready" status.
void G_teamready_cmd(gentity_t *ent, unsigned int dwCommand, qboolean state)
{
    int       i, tteam = G_teamID(ent);
    gclient_t *cl;

    // forty - in mod flood protection
    if (ClientIsFlooding(ent, qfalse))
    {
        CP("print \"^1Spam Protection: ^7dropping teamready\n\"");
        return;
    }

    if (g_gamestate.integer == GS_PLAYING || g_gamestate.integer == GS_INTERMISSION)
    {
        CP("cpm \"Match is already in progress!\n\"");
        return;
    }

    if (ent->client->sess.sessionTeam == TEAM_SPECTATOR)
    {
        CP("cpm \"Spectators can't ready a team!\n\"");
        return;
    }

    // Can't ready until enough players.
    if (level.numPlayingClients < match_minplayers.integer)
    {
        CP("cpm \"Not enough players to start match!\n\"");
        return;
    }

    if (!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName))
    {
        return;
    }

    // Move them to correct ready state
    for (i = 0; i < level.numPlayingClients; i++)
    {
        cl = level.clients + level.sortedClients[i];
        if (cl->sess.sessionTeam == tteam)
        {
            cl->pers.ready = qtrue;

            G_MakeReady(ent);
        }
    }

    G_printFull(va("%s readied the %s team!", ent->client->pers.netname, aTeams[tteam]), NULL);
    G_readyMatchState();
}
Ejemplo n.º 7
0
// ************** PAUSE / UNPAUSE
//
// Pause/unpause a match.
void G_pause_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fPause)
{
	char *status[2] = { "^5UN", "^1" };

	if(team_nocontrols.integer) { G_noTeamControls(ent); return; }

	if((PAUSE_UNPAUSING >= level.match_pause && !fPause) || (PAUSE_NONE != level.match_pause && fPause)) {
		CP(va("print \"The match is already %sPAUSED^7!\n\"", status[fPause]));
		return;
	}

	// Alias for referees
	if(ent->client->sess.referee) G_refPause_cmd(ent, fPause);
	else {
		int tteam = G_teamID(ent);

		if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName)) return;

		// Trigger the auto-handling of pauses
		if(fPause) {
			if(0 == teamInfo[tteam].timeouts) {
				CP("cpm \"^3Your team has no more timeouts remaining!\n\"");
				return;
			} else {
				teamInfo[tteam].timeouts--;
				level.match_pause = tteam + 128;
				G_globalSound("sound/misc/referee.wav");
				G_spawnPrintf(DP_PAUSEINFO, level.time + 15000, NULL);
				AP(va("print \"^3Match is ^1PAUSED^3!\n^7[%s^7: - %d Timeouts Remaining]\n\"", aTeams[tteam], teamInfo[tteam].timeouts));
				// sta acqu-sdk (issue 2): CHRUKER: b040 - Was only sending this to the client sending the command
				AP(va("cp \"^3Match is ^1PAUSED^3! (%s^3)\n\"", aTeams[tteam]));
				//CP(va("cp \"^3Match is ^1PAUSED^3! (%s^3)\n\"", aTeams[tteam]));
				// end acqu-sdk (issue 2): CHRUKER: b040
				level.server_settings |= CV_SVS_PAUSE;
				trap_SetConfigstring(CS_SERVERTOGGLES, va("%d", level.server_settings));
			}
		} else if(tteam + 128 != level.match_pause) {
			CP("cpm \"^3Your team didn't call the timeout!\n\"");
			return;
		} else {
			// sta acqu-sdk (issue 2): CHRUKER: b068 - Had extra linebreaks, before and after.
			AP("print \"^3Match is ^5UNPAUSED^3 ... resuming in 10 seconds!\n\"");
			//AP("print \"\n^3Match is ^5UNPAUSED^3 ... resuming in 10 seconds!\n\n\"");
			// end acqu-sdk (issue 2): CHRUKER: b068
			level.match_pause = PAUSE_UNPAUSING;
			G_globalSound("sound/osp/prepare.wav");
			G_spawnPrintf(DP_UNPAUSING, level.time + 10, NULL);
		}
	}
}