Beispiel #1
0
// The only way a client should ever be invitied to join a team
void G_InviteToFireTeam( int entityNum, int otherEntityNum ) {
	fireteamData_t* ft;

	if ( ( entityNum < 0 || entityNum >= MAX_CLIENTS ) || !g_entities[entityNum].client ) {
		G_Error( "G_InviteToFireTeam: invalid client" );
	}

	if ( ( otherEntityNum < 0 || otherEntityNum >= MAX_CLIENTS ) || !g_entities[otherEntityNum].client ) {
		G_Error( "G_InviteToFireTeam: invalid client" );
	}

	if ( !G_IsFireteamLeader( entityNum, &ft ) ) {
		G_ClientPrintAndReturn( entityNum, "You are not the leader of a fireteam" );
	}

	if ( g_entities[entityNum].client->sess.sessionTeam != g_entities[otherEntityNum].client->sess.sessionTeam ) {
		G_ClientPrintAndReturn( entityNum, "You are not on the same team as the other player" );
	}

	if ( G_IsOnFireteam( otherEntityNum, NULL ) ) {
		G_ClientPrintAndReturn( entityNum, "The other player is already on a fireteam" );
	}

	if ( g_entities[otherEntityNum].r.svFlags & SVF_BOT ) {
		// Gordon: bots auto join
		G_AddClientToFireteam( otherEntityNum, entityNum );
	} else {
		trap_SendServerCommand( entityNum, va( "invitation -1" ) );
		trap_SendServerCommand( otherEntityNum, va( "invitation %i", entityNum ) );
		g_entities[otherEntityNum].client->pers.invitationClient =  entityNum;
		g_entities[otherEntityNum].client->pers.invitationEndTime = level.time + 20500;
	}
}
Beispiel #2
0
// The only way a client should ever be invited to join a team
void G_InviteToFireTeam(int entityNum, int otherEntityNum)
{
	fireteamData_t *ft;

	if ((entityNum < 0 || entityNum >= MAX_CLIENTS) || !g_entities[entityNum].client)
	{
		G_Error("G_InviteToFireTeam: invalid client\n");
	}

	if ((otherEntityNum < 0 || otherEntityNum >= MAX_CLIENTS) || !g_entities[otherEntityNum].client)
	{
		G_Error("G_InviteToFireTeam: invalid client\n");
	}

	if (!G_IsFireteamLeader(entityNum, &ft))
	{
		G_ClientPrint(entityNum, "You are not the leader of a fireteam");
		return;
	}

	if (g_entities[entityNum].client->sess.sessionTeam != g_entities[otherEntityNum].client->sess.sessionTeam)
	{
		G_ClientPrint(entityNum, "You are not on the same team as the other player");
		return;
	}

	if (G_IsOnFireteam(otherEntityNum, NULL))
	{
		G_ClientPrint(entityNum, "The other player is already on a fireteam");
		return;
	}

	if (G_CountFireteamMembers(ft) >= MAX_FIRETEAM_MEMBERS)
	{
		G_ClientPrint(entityNum, "Too many players already on this fireteam");
		return;
	}

	if (g_entities[otherEntityNum].r.svFlags & SVF_BOT)
	{
		// bots auto join
		G_AddClientToFireteam(otherEntityNum, entityNum);
	}
	else
	{
		trap_SendServerCommand(entityNum, va("invitation -1"));
		trap_SendServerCommand(otherEntityNum, va("invitation %i", entityNum));
		g_entities[otherEntityNum].client->pers.invitationClient  = entityNum;
		g_entities[otherEntityNum].client->pers.invitationEndTime = level.time + 20500;
	}

#ifdef FEATURE_OMNIBOT
	Bot_Event_InviteFireTeam(entityNum, otherEntityNum);
#endif
}