Example #1
0
/*
==================
Cmd_Tell_f
==================
*/
static void Cmd_Tell_f( gentity_t *ent ) {
	int			targetNum;
	gentity_t	*target;
	char		*p;
	char		arg[MAX_TOKEN_CHARS];

	if ( trap_Argc () < 3 ) {
		trap_SendServerCommand( ent-g_entities, "print \"Usage: tell <player id> <message>\n\"" );
		return;
	}

	trap_Argv( 1, arg, sizeof( arg ) );
	targetNum = ClientNumberFromString( ent, arg );
	if ( targetNum == -1 ) {
		return;
	}

	target = &g_entities[targetNum];
	if ( !target->inuse || !target->client ) {
		return;
	}

	p = ConcatArgs( 2 );

	G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, p );
	G_Say( ent, target, SAY_TELL, p );
	// don't tell to the player self if it was already directed to this player
	// also don't send the chat back to a bot
	if ( ent != target && !(ent->r.svFlags & SVF_BOT)) {
		G_Say( ent, ent, SAY_TELL, p );
	}
}
Example #2
0
File: g_cmds.c Project: Razish/QtZ
static void Cmd_Tell_f( gentity_t *ent ) {
	int			targetNum;
	gentity_t	*target;
	char		*p, arg[MAX_TOKEN_CHARS];

	if ( trap->Cmd_Argc() < 2 )
		return;

	trap->Cmd_Argv( 1, arg, sizeof( arg ) );
	targetNum = ClientNumberFromString( ent, arg );
	if ( targetNum == -1 )
		return;

	target = &g_entities[targetNum];
	if ( !target || !target->inuse || !target->client )
		return;

	p = ConcatArgs( 2 );

	//Raz: BOF
	if ( strlen( p ) > MAX_SAY_TEXT ) {
		p[MAX_SAY_TEXT-1] = '\0';
		G_LogPrintf( "Cmd_Tell_f from %d (%s) has been truncated: %s\n", ent->s.number, ent->client->pers.netname, p );
	}

	G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, p );
	G_Say( ent, target, SAY_TELL, p );
	// don't tell to the player self if it was already directed to this player
	// also don't send the chat back to a bot
	if ( ent != target && !(ent->r.svFlags & SVF_BOT) )
		G_Say( ent, ent, SAY_TELL, p );
}
Example #3
0
// dumb wrapper for "a", "m", "chat", and "say"
static void Svcmd_MessageWrapper()
{
    char cmd[ 5 ];
    trap_Argv( 0, cmd, sizeof( cmd ) );

    if ( !Q_stricmp( cmd, "a" ) )
    {
        Cmd_AdminMessage_f( nullptr );
    }
    else if ( !Q_stricmp( cmd, "asay" ) )
    {
        G_Say( nullptr, SAY_ALL_ADMIN, ConcatArgs( 1 ) );
    }
    else if ( !Q_stricmp( cmd, "m" ) )
    {
        Cmd_PrivateMessage_f( nullptr );
    }
    else if ( !Q_stricmp( cmd, "say" ) )
    {
        G_Say( nullptr, SAY_ALL, ConcatArgs( 1 ) );
    }
    else if ( !Q_stricmp( cmd, "chat" ) )
    {
        G_Say( nullptr, SAY_RAW, ConcatArgs( 1 ) );
    }
}
Example #4
0
/*
==================
Cmd_Tell_f
==================
*/
static void Cmd_Tell_f( gentity_t *ent ) {
	int			targetNum;
	gentity_t	*target;
	char		*p;
	char		arg[MAX_TOKEN_CHARS];

	if ( trap_Argc () < 2 ) {
		return;
	}

	trap_Argv( 1, arg, sizeof( arg ) );
	targetNum = atoi( arg );
	if ( targetNum < 0 || targetNum >= level.maxclients ) {
		return;
	}

	target = &g_entities[targetNum];
	if ( !target || !target->inuse || !target->client ) {
		return;
	}

	p = ConcatArgs( 2 );

	G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, p );
	G_Say( ent, target, SAY_TELL, p );
	// don't tell to the player self if it was already directed to this player
	// also don't send the chat back to a bot
	if ( ent != target && !(ent->r.svFlags & SVF_BOT)) {
		G_Say( ent, ent, SAY_TELL, p );
	}
}
Example #5
0
// dumb wrapper for "a", "m", "chat", and "say"
static void Svcmd_MessageWrapper( void )
{
  char cmd[ 5 ];
  trap_Argv( 0, cmd, sizeof( cmd ) );

  if( !Q_stricmp( cmd, "a" ) )
    Cmd_AdminMessage_f( NULL );
  else if( !Q_stricmp( cmd, "say" ) )
    G_Say( NULL, SAY_ALL, ConcatArgs( 1 ) );
  else if( !Q_stricmp( cmd, "chat" ) )
    G_Say( NULL, SAY_RAW, ConcatArgs( 1 ) );
}
Example #6
0
qboolean	G_ConsoleCommand( void )
{
	gentity_t *ent;
	qboolean result;
	
	result = false;
	try
	{
		if ( dedicated->integer )
		{
			const char *cmd;

			cmd = gi.argv( 0 );

			if ( stricmp( cmd, "say" ) == 0 )
			{
				G_Say( NULL, false, false );
				result = true;
			}
		}

		if ( !result )
		{
			ent = &g_entities[ 0 ];
			result = G_ProcessClientCommand( ent );
		}
	}
	
	catch( const char *error )
	{
		G_ExitWithError( error );
	}
	
	return result;
}
Example #7
0
/*
===================
Svcmd_Tell_f
===================
*/
void	Svcmd_Tell_f( void ) {
	char		arg[MAX_TOKEN_CHARS];
	int			playerNum;
	gentity_t	*target;
	char		*p;

	if ( trap_Argc() < 3 ) {
		G_Printf( "Usage: tell <player id> <message>\n" );
		return;
	}

	trap_Argv( 1, arg, sizeof( arg ) );
	playerNum = PlayerForString( arg );
	if ( playerNum == -1 ) {
		return;
	}

	target = &level.gentities[playerNum];
	if ( !target->inuse || !target->player ) {
		return;
	}

	p = ConcatArgs( 2 );

	G_Say( NULL, target, SAY_TELL, p );
}
/*
===================
Svcmd_Tell_f

stell <cid> <text>
===================
*/
static void Svcmd_Tell_f( void ) {
    char str[3];
    int cid;
    gentity_t* target;

    if ( trap_Argc() < 3 ) {
        G_Printf( "usage: stell <cid> <text>\n" );
        return;
    }

    trap_Argv( 1, str, sizeof( str ) );
    cid = atoi( str );

    if ( ( cid < 0 ) || ( cid >= MAX_CLIENTS ) ) {
        G_Printf( "Not a valid client number.\n" );
        return;
    }

    target = ( g_entities + cid );

    if ( target->client->pers.connected != CON_CONNECTED ) {
        G_Printf( "Client not connected.\n" );
        return;
    }

    G_Say( NULL, target, SAY_TELL, ConcatArgs( 2 ) );
}
/*
===================
Svcmd_Say_f

ssay <text>
===================
*/
static void Svcmd_Say_f( void ) {
    if ( trap_Argc() < 2 ) {
        G_Printf( "usage: ssay <text>\n" );
        return;
    }

    G_Say( NULL, NULL, SAY_ALL, ConcatArgs( 1 ) );
}
Example #10
0
void Cmd_GameCommand_f( gentity_t *ent ) {
	int		player;
	int		order;
	char	str[MAX_TOKEN_CHARS];

	trap_Argv( 1, str, sizeof( str ) );
	player = atoi( str );
	trap_Argv( 2, str, sizeof( str ) );
	order = atoi( str );

	if ( player < 0 || player >= MAX_CLIENTS ) {
		return;
	}
	if ( order < 0 || order > ARRAY_LEN( gc_orders ) ) {
		return;
	}
	G_Say( ent, &g_entities[player], SAY_TELL, gc_orders[order] );
	G_Say( ent, ent, SAY_TELL, gc_orders[order] );
}
Example #11
0
qboolean G_SayCmd
   (
   gentity_t *ent
   )

   {
	G_Say( ent, false, false );

   return qtrue;
   }
Example #12
0
/*
===================
Svcmd_Say_f
===================
*/
void	Svcmd_Say_f( void ) {
	char		*p;

	if ( trap_Argc() < 2 ) {
		return;
	}

	p = ConcatArgs( 1 );

	G_Say( NULL, NULL, SAY_ALL, p );
}
Example #13
0
/*
=============
Svcmd_MessageWrapper
Dumb wrapper for "a" and "m" and "say"
=============
*/
void Svcmd_MessageWrapper( void )
{
  char cmd[ 5 ];
  trap_Argv( 0, cmd, sizeof( cmd ) );
  /*if( !Q_stricmp( cmd, "a" ) )
    Cmd_AdminMessage_f( NULL );
  else if( !Q_stricmp( cmd, "m" ) )
    Cmd_PrivateMessage_f( NULL );
  else*/
  if( !Q_stricmp( cmd, "say" ) )
    G_Say( NULL, NULL, SAY_ALL, ConcatArgs( 1 ) );
}
Example #14
0
void Cmd_GameCommand_f( gentity_t *ent ) {
	int                     targetNum;
	gentity_t       *target;
	int		order;
	char            arg[MAX_TOKEN_CHARS];

	if ( trap_Argc() != 3 ) {
		trap_SendServerCommand( ent-g_entities, va( "print \"Usage: gc <player id> <order 0-%d>\n\"", numgc_orders - 1 ) );
		return;
	}

	trap_Argv( 2, arg, sizeof( arg ) );
	order = atoi( arg );

	if ( order < 0 || order >= numgc_orders ) {
		trap_SendServerCommand( ent-g_entities, va("print \"Bad order: %i\n\"", order));
		return;
	}

	trap_Argv( 1, arg, sizeof( arg ) );
	targetNum = ClientNumberFromString( ent, arg );
	if ( targetNum == -1 ) {
		return;
	}

	target = &g_entities[targetNum];
	if ( !target->inuse || !target->client ) {
		return;
	}

	G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, gc_orders[order] );
	G_Say( ent, target, SAY_TELL, gc_orders[order] );
	// don't tell to the player self if it was already directed to this player
	// also don't send the chat back to a bot
	if ( ent != target && !(ent->r.svFlags & SVF_BOT)) {
		G_Say( ent, ent, SAY_TELL, gc_orders[order] );
	}
}
Example #15
0
/*
 * Cmd_Say_f
 */
static void
Cmd_Say_f(Gentity *ent, int mode, qbool arg0)
{
	char *p;

	if(trap_Argc () < 2 && !arg0)
		return;

	if(arg0)
		p = ConcatArgs(0);
	else
		p = ConcatArgs(1);

	G_Say(ent, NULL, mode, p);
}
Example #16
0
//This void is a mix of requirements to meet for the emote to work, and the custom emote animation itself.
void cm_TheEmote(int animation, gentity_t *ent, qboolean freeze)
{
	//OpenRP - Emote + /me support
	void G_Say(gentity_t *ent, gentity_t *target, int mode, const char *chatText);
	char *msg = ConcatArgs(1);

	if (ent->client->sess.spectatorState == SPECTATOR_FOLLOW || ent->client->sess.spectatorState == SPECTATOR_FREE) {
		return;
	}
	if (ent->client->ps.groundEntityNum == ENTITYNUM_NONE){
		return;
	}
	if (ent->client->ps.saberHolstered < 2){
		ent->client->ps.saberHolstered = 2;
	}
	if (BG_SaberInAttack(ent->client->ps.saberMove) || BG_SaberInSpecialAttack(ent->client->ps.saberMove) || ent->client->ps.saberLockTime){
		return;
	}
	if (freeze == qtrue)
	{
		if (ent->client->ps.forceDodgeAnim == animation)
		{
			//ent->client->emote_freeze=0;
			ent->client->ps.saberCanThrow = qtrue;
			ent->client->ps.forceDodgeAnim = 0;
			ent->client->ps.forceHandExtendTime = 0;
		}
		else
		{
			ent->client->ps.forceHandExtend = HANDEXTEND_TAUNT;
			ent->client->ps.forceDodgeAnim = animation;
			ent->client->ps.forceHandExtendTime = level.time + Q3_INFINITE;
			//ent->client->ps.persistant[PERS_REGEN] = 1;
			ent->client->ps.saberCanThrow = qfalse;
			//ent->client->emote_freeze=1;
		}
	}
	else
	{
		StandardSetBodyAnim(ent, animation, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS);
	}
	//OpenRP - Emote + /me support
	if (trap->Argc() >= 2)
		G_Say(ent, NULL, SAY_ME, msg);

	trap->SendServerCommand(ent - g_entities, "print \"^3Note: Use the emote's command again to get out of the emote.\n\"");
	return;
}
Example #17
0
File: g_cmds.c Project: Razish/QtZ
static void Cmd_SayTeam_f( gentity_t *ent ) {
	char *p = NULL;

	if ( trap->Cmd_Argc() < 2 )
		return;

	p = ConcatArgs( 1 );

	//Raz: BOF
	if ( strlen( p ) > MAX_SAY_TEXT ) {
		p[MAX_SAY_TEXT-1] = '\0';
		G_LogPrintf( "Cmd_SayTeam_f from %d (%s) has been truncated: %s\n", ent->s.number, ent->client->pers.netname, p );
	}

	G_Say( ent, NULL, (level.gametype>=GT_TEAMBLOOD) ? SAY_TEAM : SAY_ALL, p );
}
Example #18
0
void G_ClientCommand( gentity_t *ent )
{
	try
	{
		if ( ent && !G_ProcessClientCommand( ent ) )
		{
			// anything that doesn't match a command will be a chat
			G_Say( ent, false, true );
		}
	}
	
	catch( const char *error )
	{
		G_ExitWithError( error );
	}
}
Example #19
0
/*
==================
Cmd_Say_f
==================
*/
static void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 ) {
	char		*p;

	if ( trap_Argc () < 2 && !arg0 ) {
		return;
	}

	if (arg0)
	{
		p = ConcatArgs( 0 );
	}
	else
	{
		p = ConcatArgs( 1 );
	}

	G_Say( ent, NULL, mode, p );
}
Example #20
0
/*
==================

TheEmote

MJN/ClanMod

==================
*/
void TheEmote(int anim, gentity_t *ent, qboolean freeze )
{
	extern void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText );
	char *msg = ConcatArgs(1);
	int i = 0;

	if ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW || ent->client->sess.spectatorState == SPECTATOR_FREE )
		return;
	if (ent->client->ps.groundEntityNum == ENTITYNUM_NONE)
		return;
	if ( ent->client->ps.saberHolstered < 2 )
		ent->client->ps.saberHolstered = 2;
	if ( BG_SaberInAttack(ent->client->ps.saberMove) || BG_SaberInSpecialAttack(ent->client->ps.saberMove) || ent->client->ps.saberLockTime )
		return;

	//[OpenRP - Endlessly floating up bug]
	if(ent && ent->client && ent->client->forceLifting != -1)
	{
		g_entities[ent->client->forceLifting].client->ps.forceGripMoveInterval = 0;
		g_entities[ent->client->forceLifting].client->ps.forceGripChangeMovetype = PM_NORMAL;
		g_entities[ent->client->forceLifting].client->ps.pm_type = PM_NORMAL;
		g_entities[ent->client->forceLifting].client->underForceLift=qfalse;
		ent->client->forceLifting = -1;
	}
	//[/OpenRP - Endlessly floating up bug]

	ent->client->ps.forceHandExtend = HANDEXTEND_TAUNT;
	ent->client->ps.forceDodgeAnim = anim;
	// MJN - Entry for emotes
	//if (InSpecialEmote( anim ) )
	if ( freeze )
	{
		// MJN - Stop running Forcepowers
		while ( i < NUM_FORCE_POWERS )
		{
			if ( ( ent->client->ps.fd.forcePowersActive & (1 << i) ) && i != FP_LEVITATION )
				WP_ForcePowerStop(ent, i);
            i++;
		}
		ent->client->ps.forceHandExtendTime = level.time + 9999999;
		ent->client->saberKnockedTime = level.time + 9999999;
		ent->client->ps.weaponTime = 99999999;
	}
	else
	{// basejk
		ent->client->ps.forceHandExtendTime = level.time + BG_AnimLength(ent->localAnimIndex, (animNumber_t)anim);
	}

	if ( trap_Argc() >= 2 )
		G_Say( ent, NULL, SAY_ME, msg );

	return;

	/*
	if (freeze == qtrue)
	{
		if (ent->client->ps.forceDodgeAnim == anim)
		{
			StandardSetBodyAnim(ent, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
			ent->client->emote_freeze = qfalse;
			ent->client->ps.saberCanThrow = qtrue;
			ent->client->ps.forceDodgeAnim = 0;
			ent->client->ps.forceHandExtendTime = 0;
			ent->client->ps.saberMove = LS_NONE;
			ent->client->saberKnockedTime = level.time; // Enable Saber
			ent->client->ps.weaponTime = 0; // Enable Weapons
		}
		else
		{
			M_HolsterThoseSabers(ent);
			ent->client->emote_freeze = qtrue; // MJN 1
			ent->client->ps.saberMove = LS_NONE;
			ent->client->ps.saberBlocked = 0;
			ent->client->ps.saberBlocking = 0;
			ent->client->saberKnockedTime = level.time + 9999999; // Disable Saber
			ent->client->ps.weaponTime = 99999999; // Disable Weapons
			ent->client->ps.saberCanThrow = qfalse;
			ent->client->ps.forceHandExtend = HANDEXTEND_TAUNT;
			ent->client->ps.forceDodgeAnim = anim;
			ent->client->ps.forceHandExtendTime = level.time + Q3_INFINITE;
			StandardSetBodyAnim(ent, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
		}
	}
	else
	{
		StandardSetBodyAnim(ent, anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_HOLDLESS);
	}
	*/
}
Example #21
0
qboolean G_TeamSayCmd( const gentity_t *ent )
{
	G_Say( ent, true, false );

	return true;
}