Added a stuff command. Needed for misc things. See bottum of cmd_use in

g_teamplay.c
This commit is contained in:
Richard Allen 2002-05-01 18:44:36 +00:00
parent 62622ee291
commit f775db3760
4 changed files with 88 additions and 9 deletions

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.30 2002/05/01 18:44:36 jbravo
// Added a stuff command. Needed for misc things. See bottum of cmd_use in
// g_teamplay.c
//
// Revision 1.29 2002/04/30 11:20:12 jbravo // Revision 1.29 2002/04/30 11:20:12 jbravo
// Redid the teamcount cvars. // Redid the teamcount cvars.
// //
@ -1096,6 +1100,38 @@ static void CG_RemoveChatEscapeChar( char *text ) {
text[l] = '\0'; text[l] = '\0';
} }
/*
=================
CG_ConcatArgs
Recontruct arguments into a whole string
=================
*/
char *CG_ConcatArgs (int start) {
int i, c, tlen, len;
static char line[MAX_STRING_CHARS];
char arg[MAX_STRING_CHARS];
len = 0;
c = trap_Argc();
for (i = start; i < c; i++) {
trap_Argv (i, arg, sizeof (arg));
tlen = strlen (arg);
if (len + tlen >= MAX_STRING_CHARS - 1) {
break;
}
memcpy (line + len, arg, tlen);
len += tlen;
if (i != c - 1) {
line[len] = ' ';
len++;
}
}
line[len] = 0;
return line;
}
/* /*
================= =================
CG_ServerCommand CG_ServerCommand
@ -1305,14 +1341,12 @@ static void CG_ServerCommand( void ) {
// NiceAss: LCA // NiceAss: LCA
if ( !strcmp( cmd, "lights") ) { if ( !strcmp( cmd, "lights") ) {
trap_Cvar_Set("cg_RQ3_lca", "1"); trap_Cvar_Set("cg_RQ3_lca", "1");
if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED || cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE) { cg.showScores = qfalse;
cg.showScores = qfalse; cg.scoreTPMode = 0;
cg.scoreTPMode = 0;
}
CG_CenterPrint( "LIGHTS...", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH ); CG_CenterPrint( "LIGHTS...", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
CG_Printf("\nLIGHTS...\n"); CG_Printf("\nLIGHTS...\n");
trap_S_StartLocalSound(cgs.media.lightsSound, CHAN_ANNOUNCER); // trap_S_StartLocalSound(cgs.media.lightsSound, CHAN_ANNOUNCER);
// CG_AddBufferedSound(cgs.media.lightsSound); CG_AddBufferedSound(cgs.media.lightsSound);
return; return;
} }
if ( !strcmp( cmd, "camera") ) { if ( !strcmp( cmd, "camera") ) {
@ -1342,6 +1376,14 @@ static void CG_ServerCommand( void ) {
cg.scoreTPMode = 0; cg.scoreTPMode = 0;
return; return;
} }
if (!strcmp(cmd, "stuff")) {
char *cmd;
cmd = CG_ConcatArgs (1);
trap_SendConsoleCommand (cmd);
// CG_Printf ("Got the following cmd: %s\n", cmd);
return;
}
// JBravo: Number of players hack. // JBravo: Number of players hack.
if (!strcmp(cmd, "setteamplayers")) { if (!strcmp(cmd, "setteamplayers")) {
int team, number; int team, number;

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.101 2002/05/01 18:44:36 jbravo
// Added a stuff command. Needed for misc things. See bottum of cmd_use in
// g_teamplay.c
//
// Revision 1.100 2002/04/30 11:54:37 makro // Revision 1.100 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things // Bots rule ! Also, added clips to give all. Maybe some other things
// //
@ -2903,6 +2907,8 @@ void ClientCommand( int clientNum ) {
// JBravo: adding tkok // JBravo: adding tkok
else if (Q_stricmp (cmd, "tkok") == 0) else if (Q_stricmp (cmd, "tkok") == 0)
RQ3_Cmd_TKOk (ent); RQ3_Cmd_TKOk (ent);
else if (Q_stricmp (cmd, "stuff") == 0)
RQ3_Cmd_Stuff (ent);
//Elder: stuff for dropping items //Elder: stuff for dropping items
else if (Q_stricmp (cmd, "dropitem") == 0) else if (Q_stricmp (cmd, "dropitem") == 0)
Cmd_DropItem_f( ent ); Cmd_DropItem_f( ent );

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.72 2002/05/01 18:44:36 jbravo
// Added a stuff command. Needed for misc things. See bottum of cmd_use in
// g_teamplay.c
//
// Revision 1.71 2002/04/30 11:54:37 makro // Revision 1.71 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things // Bots rule ! Also, added clips to give all. Maybe some other things
// //
@ -1634,9 +1638,8 @@ void RQ3_Cmd_Use_f(gentity_t *ent)
} }
if (weapon == ent->client->ps.weapon) if (weapon == ent->client->ps.weapon)
return; return;
Com_sprintf (buf, sizeof(buf), "weapon %d\n", weapon); Com_sprintf (buf, sizeof(buf), "stuff weapon %d\n", weapon);
// trap_SendConsoleCommand(EXEC_APPEND, buf); trap_SendServerCommand(ent-g_entities, buf);
trap_SendServerCommand(EXEC_APPEND, buf);
} }
void Add_TeamWound(gentity_t *attacker, gentity_t *victim, int mod) void Add_TeamWound(gentity_t *attacker, gentity_t *victim, int mod)
@ -1742,3 +1745,26 @@ void RQ3_Cmd_TKOk (gentity_t *ent)
ent->enemy = NULL; ent->enemy = NULL;
} }
void RQ3_Cmd_Stuff (gentity_t *ent)
{
char *cmd, user[128];
int len, client;
len = trap_Argc ();
if (len < 3) {
trap_SendServerCommand(ent-g_entities, va("print \"Usage: stuff <user id> <text>\n\""));
return;
}
trap_Argv(1, user, sizeof(user));
if (user[0] < '0' || user[0] > '9') {
trap_SendServerCommand(ent-g_entities, va("print \"Usage: stuff <user id> <text>\n\""));
return;
}
client = atoi (user);
cmd = ConcatArgs(2);
trap_SendServerCommand(client, va("stuff %s\n", cmd));
}

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.13 2002/05/01 18:44:36 jbravo
// Added a stuff command. Needed for misc things. See bottum of cmd_use in
// g_teamplay.c
//
// Revision 1.12 2002/04/26 03:39:34 jbravo // Revision 1.12 2002/04/26 03:39:34 jbravo
// added tkok, fixed players always leaving zcam modes when player thats // added tkok, fixed players always leaving zcam modes when player thats
// beeing tracked dies // beeing tracked dies
@ -80,5 +84,6 @@ void ParseSayText (gentity_t * ent, char *text);
void RQ3_SpectatorMode(gentity_t *ent); void RQ3_SpectatorMode(gentity_t *ent);
void Add_TeamKill(gentity_t *attacker); void Add_TeamKill(gentity_t *attacker);
void RQ3_Cmd_TKOk(gentity_t *ent); void RQ3_Cmd_TKOk(gentity_t *ent);
void RQ3_Cmd_Stuff(gentity_t *ent);
void Add_TeamWound(gentity_t *attacker, gentity_t *victim, int mod); void Add_TeamWound(gentity_t *attacker, gentity_t *victim, int mod);
void setFFState(gentity_t *ent); void setFFState(gentity_t *ent);