// 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 ) ); } }
/* ============ 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 ) ); }
/* =================== 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)) ); }
// 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 ) ); }
/* * 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); }
/* * 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); }
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)); }
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 ); }
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 ); }
/* =================== 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) ) ); }
/* =================== 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 ); }
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); }
/* ================== Cmd_VoiceTell_f ================== */ static void Cmd_VoiceTell_f( gentity_t *ent, qboolean voiceonly ) { int targetNum; gentity_t *target; char *id; char arg[MAX_TOKEN_CHARS]; if ( trap_Argc () < 3 ) { trap_SendServerCommand( ent-g_entities, va( "print \"Usage: %s <player id> <voice id>\n\"", voiceonly ? "votell" : "vtell" ) ); return; } trap_Argv( 1, arg, sizeof( arg ) ); targetNum = atoi( arg ); if ( targetNum < 0 || targetNum >= level.maxclients ) { return; } target = &g_entities[targetNum]; if ( !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 ); } }
/* * 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); }
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; }
/* =================== 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 ) ); }
static void Svcmd_TeamMessage_f( void ) { char teamNum[ 2 ]; team_t team; char *arg; 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 == NUM_TEAMS ) { G_Printf( "say_team: invalid team \"%s\"\n", teamNum ); return; } arg = ConcatArgs( 2 ); G_TeamCommand( team, va( "chat -1 %d %s", SAY_TEAM, Quote( arg ) ) ); G_LogPrintf( "SayTeam: -1 \"console\": %s\n", arg ); }
/* ================== 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 ); } }
/* ================== 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 ); } }
/* =================== 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 ) ); }
void Cmd_Give_f( gentity_t *ent ) { if ( !CheatsOk( ent ) ) { return; } G_Give( ent, gi.argv(1), ConcatArgs( 2 ), gi.argc() ); }
/* ================== 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 ); }
/* ================== Cmd_Voice_f ================== */ static void Cmd_Voice_f( gentity_t *ent, int mode, qboolean arg0, qboolean 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 ); }
static void Svcmd_CenterPrint_f( void ) { if( trap_Argc( ) < 2 ) { G_Printf( "usage: cp <message>\n" ); return; } trap_SendServerCommand( -1, va( "cp \"%s\"", ConcatArgs( 1 ) ) ); }
void Cmd_Spawn( gentity_t *ent ) { char *name; name = ConcatArgs( 1 ); gi.SendServerCommand( ent-g_entities, "print \"Spawning '%s'\n\"", name ); UserSpawn( ent, name ); }
static void Svcmd_CenterPrint_f() { if ( trap_Argc() < 2 ) { Log::Notice( "usage: cp <message>" ); return; } trap_SendServerCommand( -1, va( "cp %s", Quote( ConcatArgs( 1 ) ) ) ); }
bool HandleNameHashCommand(BaseConsole* pConsole, int argc, const char* argv[]) { if(!argc) return false; string spname; ConcatArgs(spname, argc, 0, argv); pConsole->Write("Name Hash for %s is 0x%X" , spname.c_str() , crc32((const unsigned char*)spname.c_str(), (unsigned int)spname.length())); sWorld.Rehash(true); return true; }
/* =================== 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 ); }
/* ============= 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 ) ); }
static void SV_Lua_f( void ) { char *args = NULL; if ( trap->Argc() < 2 || !JPLua::IsInitialised() ) { return; } args = ConcatArgs( 1 ); trap->Print( S_COLOR_CYAN "Executing Lua code: %s\n", args ); JPLua::DoString( args ); }