Esempio n. 1
0
//Adds an edict to ignore list. If allready in, it will be removed
void _AddOrDelIgnoreSubject (edict_t * source, edict_t * subject, qboolean silent)
{
	int i;

	if (!source->client)
		return;
	if (!subject->client || !subject->inuse)
	{
		gi.cprintf (source, PRINT_MEDIUM, "\nOnly valid clients may be added to ignore list!\n");
		return;
	}

	i = IsInIgnoreList (source, subject);
	if (i)
	{
		//subject is in ignore list, so delete it
		source->IGNORELIST[i] = NULL;
		if (!silent)
			gi.cprintf (source, PRINT_MEDIUM, "\n%s was removed from ignore list.\n",
				subject->client->pers.netname);

		//Maybe this has to be taken out :)

		if( ! silent && ! IsInIgnoreList( subject, source ) )
			gi.cprintf (subject, PRINT_MEDIUM, "\n%s listens to your words.\n",
				source->client->pers.netname);

		source->client->resp.ignore_time = level.realFramenum;
	}
	else
	{
		//subject has to be added
		i = _FindFreeIgnoreListEntry (source);

		if (!i)
		{
			if (!silent)
				gi.cprintf (source, PRINT_MEDIUM, "\nSorry, ignore list is full!\n");
		}
		else
		{
			//we've found a place
			source->IGNORELIST[i] = subject;
			if (!silent)
				gi.cprintf (source, PRINT_MEDIUM, "\n%s was added to ignore list.\n",
					subject->client->pers.netname);

			//Maybe this has to be taken out :)

			if( ! silent && ! IsInIgnoreList( subject, source ) )
				gi.cprintf (subject, PRINT_MEDIUM, "\n%s ignores you.\n",
				source->client->pers.netname);
		}
	}
}
Esempio n. 2
0
void _AddIgnoreuserToMenu (edict_t * ent, int fromix)
{
	int i, j;
	edict_t *other;
	qboolean erg;
	char buf[256];

	j = 0;
	for (i = 0, other = g_edicts + 1; i < game.maxclients && j < fromix; i++, other++)
	{
		if (other->inuse && other != ent)
			j++;
	}
	erg = true;
	for (; i < game.maxclients && erg; i++, other++)
	{
		if (other->inuse && other != ent)
		{
			//+ Marker: Hier gewählten markieren - erledigt -
			sprintf (buf, "%s%2i: %s", IsInIgnoreList (ent, other) ? "*" : "",
			i, other->client->pers.netname);
			erg = xMenu_Add (ent, buf, _IgnoreSelected);
		}
	}
}
Esempio n. 3
0
void _ClrIgnoresOn (edict_t *target)
{
	edict_t *other;
	int i;

	for (i = 0, other = g_edicts + 1; i < game.maxclients; i++, other++)
	{
		if (!other->client || !other->inuse)
			continue;

		if (IsInIgnoreList(other, target))
			_AddOrDelIgnoreSubject(other, target, true);
	}
}
Esempio n. 4
0
void _ClrIgnoresOn (edict_t * target)
{
	edict_t *other;
	int i;

	for (i = 1; i <= game.maxclients; i++)
	{
		other = &g_edicts[i];
		if (other->client && other->inuse)
		{
			if (IsInIgnoreList (other, target))
				_AddOrDelIgnoreSubject (other, target, true);
		}
	}
}
Esempio n. 5
0
qboolean _ilMarkThis (edict_t *self, edict_t *other)
{
	if (IsInIgnoreList (self, other))
		return true;
	return false;
}
Esempio n. 6
0
//Returns the next free slot in ignore list
int _FindFreeIgnoreListEntry (edict_t * source)
{
  return (IsInIgnoreList (source, NULL));
}
Esempio n. 7
0
/*
==================
Cmd_Say_f
==================
*/
void Cmd_Say_f (edict_t * ent, qboolean team, qboolean arg0, qboolean partner_msg)
{
	int j, i, offset_of_text;
	edict_t *other;
	char *args, text[256], *s;
	gclient_t *cl;
	int meing = 0, isadmin = 0;

	if (gi.argc() < 2 && !arg0)
		return;
	
	args = gi.args();

	if (!sv_crlf->value)
	{
		if (strchr(args, '\r') || strchr(args, '\n'))
		{
			gi.cprintf (ent, PRINT_HIGH, "No control characters in chat messages!\n");
			return;
		}
	}

	//TempFile - BEGIN
	if (arg0)
	{
		if (!Q_stricmp("%me", gi.argv(0))) {
			meing = 4;
			if(!args || !*args)
				return;
		}
	}
	else
	{
		if(!args || !*args)
			return;

		if (!Q_strnicmp("%me", args, 3))
			meing = 4;
		else if (!Q_strnicmp("%me", args + 1, 3))
			meing = 5;

		if(meing)
		{
			if (!*(args+meing-1))
				return;
			if (*(args+meing-1) != ' ')
				meing = 0;
			else if(!*(args+meing))
				return;
		}
	}
	//TempFile - END

	if (!teamplay->value)
	{
		//FIREBLADE
		if (!((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS)))
			team = false;
	}
	else if (matchmode->value)
	{	
		if (ent->client->resp.admin)
			isadmin = 1;

		if (mm_forceteamtalk->value == 1)
		{
			if (!ent->client->resp.captain && !partner_msg && !isadmin)
				team = true;
		}
		else if (mm_forceteamtalk->value == 2)
		{
			if (!ent->client->resp.captain && !partner_msg && !isadmin &&
				(TeamsReady() || team_round_going))
				team = true;
		}
	}

	if (team)
	{
		if (ent->client->resp.team == NOTEAM)
		{
			gi.cprintf (ent, PRINT_HIGH, "You're not on a team.\n");
			return;
		}
		if (!meing)		// TempFile
			Com_sprintf (text, sizeof (text), "%s(%s): ",
			(teamplay->value && (ent->solid == SOLID_NOT
			|| ent->deadflag == DEAD_DEAD)) ? "[DEAD] " : "",
			ent->client->pers.netname);
		//TempFile - BEGIN
		else
			Com_sprintf (text, sizeof (text), "(%s%s ",
			(teamplay->value && (ent->solid == SOLID_NOT
			|| ent->deadflag == DEAD_DEAD)) ? "[DEAD] " : "",
			ent->client->pers.netname);
		//TempFile - END
	}
	else if (partner_msg)
	{
		if (ent->client->resp.radio_partner == NULL)
		{
			gi.cprintf (ent, PRINT_HIGH, "You don't have a partner.\n");
			return;
		}
		if (!meing)		//TempFile
			Com_sprintf (text, sizeof (text), "[%sPARTNER] %s: ",
			(teamplay->value && (ent->solid == SOLID_NOT
			|| ent->deadflag == DEAD_DEAD)) ? "DEAD " : "",
			ent->client->pers.netname);
		//TempFile - BEGIN
		else
			Com_sprintf (text, sizeof (text), "%s partner %s ",
			(teamplay->value && (ent->solid == SOLID_NOT
			|| ent->deadflag == DEAD_DEAD)) ? "[DEAD] " : "",
			ent->client->pers.netname);
		//TempFile - END
	}
	else
	{
		if (!meing)		//TempFile
		{
			if (isadmin)
				Com_sprintf (text, sizeof (text), "[ADMIN] %s: ",
				ent->client->pers.netname);
			else
				Com_sprintf (text, sizeof (text), "%s%s: ",
				(teamplay->value && (ent->solid == SOLID_NOT
				|| ent->deadflag == DEAD_DEAD)) ? "[DEAD] " : "",
				ent->client->pers.netname);
		}
		else
			Com_sprintf (text, sizeof (text), "%s%s ",
			(teamplay->value && (ent->solid == SOLID_NOT
			|| ent->deadflag == DEAD_DEAD)) ? "[DEAD] " : "",
			ent->client->pers.netname);
	}
	//TempFile - END
	
	offset_of_text = strlen (text);	//FB 5/31/99
	if (!meing)		//TempFile
	{
		if (arg0)
		{
			Q_strncatz(text, gi.argv (0), sizeof(text));
			if(*args) {
				Q_strncatz(text, " ", sizeof(text));
				Q_strncatz(text, args, sizeof(text));
			}
		}
		else
		{	
			if (*args == '"') {
				args++;
				args[strlen(args) - 1] = 0;
			}
			Q_strncatz(text, args, sizeof(text));
		}
	}
	else			// if meing
	{
		if (arg0)
		{
			//this one is easy: gi.args() cuts /me off for us!
			Q_strncatz(text, args, sizeof(text));
		}
		else
		{
			// we have to cut off "%me ".
			args += meing;
			if (args[strlen(args) - 1] == '"')
				args[strlen(args) - 1] = 0;
			Q_strncatz(text, args, sizeof(text));
		}
		
		if (team)
			Q_strncatz(text, ")", sizeof(text));
	}
	//TempFile - END
	// don't let text be too long for malicious reasons
	if (strlen(text) >= 254)
		text[254] = 0;
	
	if (ent->solid != SOLID_NOT && ent->deadflag != DEAD_DEAD)
	{
		s = strchr(text + offset_of_text, '%');
		if(s) {
			// this will parse the % variables,
			ParseSayText (ent, s, sizeof(text) - (s - text+1) - 2);
		}
	}

	Q_strncatz(text, "\n", sizeof(text));

	if (flood_msgs->value)
	{
		cl = ent->client;

		if (realLtime < cl->flood_locktill)
		{
			gi.cprintf (ent, PRINT_HIGH, "You can't talk for %d more seconds.\n",
					(int) (cl->flood_locktill - realLtime));
			return;
		}
		i = cl->flood_whenhead - flood_msgs->value + 1;
		if (i < 0)
			i = (sizeof (cl->flood_when) / sizeof (cl->flood_when[0])) + i;
		if (cl->flood_when[i] &&
			realLtime - cl->flood_when[i] < flood_persecond->value)
		{
			cl->flood_locktill = realLtime + flood_waitdelay->value;
			gi.cprintf (ent, PRINT_HIGH, "You can't talk for %d seconds.\n",
				(int) flood_waitdelay->value);
			return;
		}
		cl->flood_whenhead = (cl->flood_whenhead + 1) %
			(sizeof (cl->flood_when) / sizeof (cl->flood_when[0]));
		cl->flood_when[cl->flood_whenhead] = realLtime;
	}
	
	if (dedicated->value) {
		gi.cprintf (NULL, PRINT_CHAT, "%s", text);
		if ((!team) && (!partner_msg)) {
			IRC_printf (IRC_T_TALK, "%s", text);
		}
	}
	
	for (j = 1; j <= game.maxclients; j++)
	{
		other = &g_edicts[j];
		if (!other->inuse)
			continue;
		if (!other->client)
			continue;
		if (team)
		{
			// if we are the adminent... we might want to hear (if hearall is set)
			if (!matchmode->value || !hearall->value || !other->client->resp.admin)	// hearall isn't set and we aren't adminent
				if (!OnSameTeam (ent, other))
					continue;
		}
		if (partner_msg)
		{
			if (other != ent->client->resp.radio_partner && other != ent)
				continue;
		}
		//FIREBLADE
		if (teamplay->value && team_round_going)
		{
			if ((ent->solid == SOLID_NOT || ent->deadflag == DEAD_DEAD) &&
				(other->solid != SOLID_NOT && other->deadflag != DEAD_DEAD)
				&& !ctf->value && !teamdm->value)	//AQ2:TNG Slicer
				continue;
		}
		//FIREBLADE
		//PG BUND - BEGIN
		if (IsInIgnoreList (other, ent))
			continue;
		//PG BUND - END
		gi.cprintf (other, PRINT_CHAT, "%s", text);
	}

}
Esempio n. 8
0
// RadioThink should be called once on each player per server frame.
void RadioThink (edict_t * ent)
{
	radio_t *radio = &ent->client->resp.radio;

	// Try to clean things up, a bit....
	if (radio->partner)
	{
		if (!radio->partner->inuse ||
			radio->partner->client->resp.radio.partner != ent)
		{
			radio->partner = NULL;
		}
	}
	if (radio->partner_last_offered_to)
	{
		if (!radio->partner_last_offered_to->inuse ||
			radio->partner_last_offered_to->solid == SOLID_NOT)
		{
			radio->partner_last_offered_to = NULL;
		}
	}
	if (radio->partner_last_denied_from)
	{
		if (!radio->partner_last_denied_from->inuse ||
			radio->partner_last_denied_from->solid == SOLID_NOT)
		{
			radio->partner_last_denied_from = NULL;
		}
	}
	// ................................

	if (radio->power_off)
	{
		radio->queue_size = 0;
		return;
	}

	if (radio->delay > 0)
	{
		radio->delay--;
		if (radio->delay)
			return;
	}


	if (radio->queue_size)
	{
		edict_t *from;
		int check;

		from = radio->queue[0].from_player;

		if (!radio->queue[0].click && (!from->inuse || !IS_ALIVE(from)))
		{
			if (radio->queue[0].from_gender)
			{
				radio->queue[0].sndIndex = globalRadio[RADIO_DEATH_FEMALE].sndIndex;
				radio->queue[0].length = globalRadio[RADIO_DEATH_FEMALE].length;
			}
			else
			{
				radio->queue[0].sndIndex = globalRadio[RADIO_DEATH_MALE].sndIndex;
				radio->queue[0].length = globalRadio[RADIO_DEATH_MALE].length;
			}

			for (check = 1; check < radio->queue_size; check++)
			{
				if (!radio->queue[check].click && radio->queue[check].from_player == from)
				{
					DeleteRadioQueueEntry( radio, check );
					check--;
				}
			}
		}

		if( ! IsInIgnoreList( ent, from ) )
		{
			unicastSound( ent, radio->queue[0].sndIndex, 1.0 );
			radio->delay = radio->queue[0].length;
		}
		DeleteRadioQueueEntry( radio, 0 ); //We can remove it here?
	}
}