本文整理汇总了C++中ConcatArgs函数的典型用法代码示例。如果您正苦于以下问题:C++ ConcatArgs函数的具体用法?C++ ConcatArgs怎么用?C++ ConcatArgs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ConcatArgs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Svcmd_MessageWrapper
// 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 ) );
}
}
示例2: Svcmd_TeamMessage_f
/*
============
Svcmd_TeamMessage_f
Sends a Chat Message to a Team from the Console
============
*/
void Svcmd_TeamMessage_f( void )
{
char teamNum[ 2 ];
const char* prefix;
team_t team;
if( trap_Argc( ) < 3 )
{
G_Printf( "usage: say_team <team> <message>\n" );
return;
}
trap_Argv( 1, teamNum, sizeof( teamNum ) );
team = G_TeamFromString( teamNum );
if( team == TEAM_NUM_TEAMS )
{
G_Printf( "say_team: invalid team \"%s\"\n", teamNum );
return;
}
prefix = BG_TeamName( team );
prefix = va( "[%c] ", toupper( *prefix ) );
G_TeamCommand( team, va( "tchat \"(console): " S_COLOR_CYAN "%s\"", ConcatArgs( 2 ) ) );
G_LogPrintf( "sayteam: %sconsole: " S_COLOR_CYAN "%s\n", prefix, ConcatArgs( 2 ) );
}
示例3: Svcmd_SendAway_f
/*
===================
Svcmd_SendAway_f
Tequila: Replacement for kick command from server engine with sendaway one
*
sendaway <playername>
===================
*/
void Svcmd_SendAway_f(void) {
// find the player
gclient_t *cl = ClientForString( ConcatArgs(1) );
if ( cl )
trap_SendConsoleCommand( EXEC_INSERT, va("clientkick %i\n", cl->ps.clientNum) );
else
trap_SendServerCommand( -1, va("print \"Can't kick %s\"", ConcatArgs(1)) );
}
示例4: Svcmd_MessageWrapper
// 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 ) );
}
示例5: Cmd_Say_f
/*
* 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);
}
示例6: Cmd_Voice_f
/*
* Cmd_Voice_f
*/
static void
Cmd_Voice_f(Gentity *ent, int mode, qbool arg0, qbool voiceonly)
{
char *p;
if(trap_Argc () < 2 && !arg0)
return;
if(arg0)
p = ConcatArgs(0);
else
p = ConcatArgs(1);
G_Voice(ent, NULL, mode, p, voiceonly);
}
示例7: CG_SayTeamAlias_f
static void CG_SayTeamAlias_f(void) {
char *p = NULL;
if (trap_Argc () < 2)
return;
p = ConcatArgs(1);
trap_SendConsoleCommand(va("cmd say_team %s", p));
}
示例8: Cmd_GiveOther_f
static void Cmd_GiveOther_f( gentity_t *ent ) {
char name[MAX_TOKEN_CHARS] = {0};
int i;
char otherindex[MAX_TOKEN_CHARS];
gentity_t *otherEnt = NULL;
trap->Cmd_Argv( 1, otherindex, sizeof( otherindex ) );
if ( !otherindex[0] )
{
trap->SV_GameSendServerCommand( ARRAY_INDEX( g_entities, ent ), "print \"giveother requires that the second argument be a client index number.\n\"" );
return;
}
i = atoi( otherindex );
if ( i < 0 || i >= MAX_CLIENTS )
{
trap->SV_GameSendServerCommand( ARRAY_INDEX( g_entities, ent ), va( "print \"%i is not a client index.\n\"", i ) );
return;
}
otherEnt = &g_entities[i];
if ( !otherEnt->inuse || !otherEnt->client )
{
trap->SV_GameSendServerCommand( ARRAY_INDEX( g_entities, ent ), va( "print \"%i is not an active client.\n\"", i ) );
return;
}
trap->Cmd_Argv( 2, name, sizeof( name ) );
G_Give( otherEnt, name, ConcatArgs( 3 ), trap->Cmd_Argc()-1 );
}
示例9: Cmd_Tell_f
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 );
}
示例10: Svcmd_BigText_f
/*
===================
Svcmd_BigText_f
Tequila: BigText command suggested by villa
[bigtext|cp] [-1|clientNumber|playername] <message>
===================
*/
void Svcmd_BigText_f(void) {
gclient_t *cl;
char str[MAX_TOKEN_CHARS];
trap_Argv( 1, str, sizeof( str ) );
verbose = qfalse ;
cl = ClientForString( str );
verbose = qtrue ;
if ( cl ) {
trap_SendServerCommand( cl->ps.clientNum, va("cp \"%s\"", ConcatArgs(2) ) );
} else if ( Q_stricmp ("-1", str) == 0 )
trap_SendServerCommand( -1, va("cp \"%s\"", ConcatArgs(2) ) );
else
trap_SendServerCommand( -1, va("cp \"%s\"", ConcatArgs(1) ) );
}
示例11: Svcmd_Tell_f
/*
===================
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 );
}
示例12: myClientCommand
void myClientCommand(int num) {
/*
Scr_AddInt(num);
int result = Scr_ExecEntThread(num, 0, callbackPlayerCommand, 1);
Scr_FreeThread(result);
*/
char cmd[MAX_STRING_CHARS];
Cmd_ArgvBuffer(0, cmd, sizeof(cmd));
//printf("%d[%s]\n", num, cmd);
ENTITY* ent = game->getEntity(num);
if(strcmp(cmd, "say") == 0) {
char* saidn = ConcatArgs(1);
char* said = &said[2];
FILE *f = fopen("/home/cod/chatlog.txt", "a");
if(f != NULL) {
fprintf(f, "%d:", num);
fprintf(f, said);
fprintf(f, "\n");
fclose(f);
}
} else if(strcmp(cmd, "codextended") == 0) {
SV_SendServerCommand(num, 0, "e \"This server is running Call of Duty Extended\"");
return;
} else if(!strcmp(cmd, "god")) {
Cmd_God(ent);
return;
}
void (*call)(int);
*((int*)(&call)) = GAME("ClientCommand");
call(num);
}
示例13: Cmd_VoiceTell_f
/*
* Cmd_VoiceTell_f
*/
static void
Cmd_VoiceTell_f(Gentity *ent, qbool voiceonly)
{
int targetNum;
Gentity *target;
char *id;
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;
id = ConcatArgs(2);
G_LogPrintf("vtell: %s to %s: %s\n", ent->client->pers.netname,
target->client->pers.netname,
id);
G_Voice(ent, target, SAY_TELL, id, voiceonly);
/* 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_Voice(ent, ent, SAY_TELL, id, voiceonly);
}
示例14: G_SayArgv
qboolean G_SayArgv( int n, char *buffer, int bufferLength )
{
char *s;
if( bufferLength < 1 )
return qfalse;
if( n < 0 )
return qfalse;
s = ConcatArgs( 0 );
while( 1 )
{
while( *s == ' ' )
s++;
if( !*s || n == 0 )
break;
n--;
while( *s && *s != ' ' )
s++;
}
if( n > 0 )
return qfalse;
//memccpy( buffer, s, ' ', bufferLength );
while( *s && *s != ' ' && bufferLength > 1 )
{
*buffer++ = *s++;
bufferLength--;
}
*buffer = 0;
return qtrue;
}
示例15: Svcmd_Tell_f
/*
===================
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 ) );
}