2001-12-31 16:16:59 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// $Log$
|
2003-04-19 17:41:26 +00:00
|
|
|
// Revision 1.15 2003/04/19 17:41:26 jbravo
|
|
|
|
// Applied changes that where in 1.29h -> 1.32b gamecode.
|
|
|
|
//
|
2002-08-02 22:44:37 +00:00
|
|
|
// Revision 1.14 2002/08/02 22:44:37 slicer
|
|
|
|
// Added resetMatch command for MM
|
|
|
|
//
|
2002-06-19 18:13:57 +00:00
|
|
|
// Revision 1.13 2002/06/19 18:13:57 jbravo
|
|
|
|
// New TNG spawning system :)
|
|
|
|
//
|
2002-06-18 03:57:38 +00:00
|
|
|
// Revision 1.12 2002/06/18 03:57:38 jbravo
|
|
|
|
// Committing for aasimon. Callvote nextmap removed and replaced with cyclemap for .ini
|
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
// Revision 1.11 2002/06/16 20:06:14 jbravo
|
|
|
|
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
|
|
|
|
//
|
2002-06-10 17:40:52 +00:00
|
|
|
// Revision 1.10 2002/06/10 17:40:52 slicer
|
|
|
|
// Added MM's ClearScores command as console cmd also
|
|
|
|
//
|
2002-05-20 04:59:33 +00:00
|
|
|
// Revision 1.9 2002/05/20 04:59:33 jbravo
|
|
|
|
// Lots of small fixes.
|
|
|
|
//
|
2002-05-04 16:19:02 +00:00
|
|
|
// Revision 1.8 2002/05/04 16:19:02 jbravo
|
|
|
|
// Fixing the stuff cmd to work on dedicated servers.
|
|
|
|
//
|
2002-04-03 15:51:01 +00:00
|
|
|
// Revision 1.7 2002/04/03 15:51:01 jbravo
|
|
|
|
// Small warning fixes
|
|
|
|
//
|
2002-02-26 03:58:19 +00:00
|
|
|
// Revision 1.6 2002/02/26 03:58:19 jbravo
|
|
|
|
// Added a newline to the say messages from the server
|
|
|
|
//
|
2002-01-11 19:48:33 +00:00
|
|
|
// Revision 1.5 2002/01/11 19:48:30 jbravo
|
|
|
|
// Formatted the source in non DOS format.
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// Revision 1.4 2001/12/31 16:28:42 jbravo
|
|
|
|
// I made a Booboo with the Log tag.
|
|
|
|
//
|
2001-12-31 16:16:59 +00:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2001-05-06 20:50:27 +00:00
|
|
|
// Copyright (C) 1999-2000 Id Software, Inc.
|
|
|
|
//
|
|
|
|
|
|
|
|
// this file holds commands that can be executed by the server console, but not remote clients
|
|
|
|
|
|
|
|
#include "g_local.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
PACKET FILTERING
|
|
|
|
|
|
|
|
|
|
|
|
You can add or remove addresses from the filter list with:
|
|
|
|
|
|
|
|
addip <ip>
|
|
|
|
removeip <ip>
|
|
|
|
|
2003-04-19 17:41:26 +00:00
|
|
|
The ip address is specified in dot format, and you can use '*' to match any value so you can specify an entire class C network with "addip 192.246.40.*"
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
Removeip will only remove an address specified exactly the same way. You cannot addip a subnet, then removeip a single host.
|
|
|
|
|
|
|
|
listip
|
|
|
|
Prints the current list of filters.
|
|
|
|
|
|
|
|
g_filterban <0 or 1>
|
|
|
|
|
|
|
|
If 1 (the default), then ip addresses matching the current list will be prohibited from entering the game. This is the default setting.
|
|
|
|
|
|
|
|
If 0, then only addresses matching the list will be allowed. This lets you easily set up a private game, or a game that only allows players from your local network.
|
|
|
|
|
2003-04-19 17:41:26 +00:00
|
|
|
TTimo NOTE: for persistence, bans are stored in g_banIPs cvar MAX_CVAR_VALUE_STRING
|
|
|
|
The size of the cvar string buffer is limiting the banning to around 20 masks
|
|
|
|
this could be improved by putting some g_banIPs2 g_banIps3 etc. maybe
|
|
|
|
still, you should rely on PB for banning instead
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
==============================================================================
|
|
|
|
*/
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
typedef struct ipFilter_s {
|
|
|
|
unsigned mask;
|
|
|
|
unsigned compare;
|
2001-05-06 20:50:27 +00:00
|
|
|
} ipFilter_t;
|
|
|
|
|
|
|
|
#define MAX_IPFILTERS 1024
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
static ipFilter_t ipFilters[MAX_IPFILTERS];
|
|
|
|
static int numIPFilters;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
StringToFilter
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
static qboolean StringToFilter(char *s, ipFilter_t * f)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
char num[128];
|
|
|
|
int i, j;
|
|
|
|
byte b[4];
|
|
|
|
byte m[4];
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2001-05-06 20:50:27 +00:00
|
|
|
b[i] = 0;
|
|
|
|
m[i] = 0;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (*s < '0' || *s > '9') {
|
2003-04-19 17:41:26 +00:00
|
|
|
if (*s == '*') { // 'match any'
|
|
|
|
// b[i] and m[i] to 0
|
|
|
|
s++;
|
|
|
|
if (!*s)
|
|
|
|
break;
|
|
|
|
s++;
|
|
|
|
continue;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
G_Printf("Bad filter address: %s\n", s);
|
2001-05-06 20:50:27 +00:00
|
|
|
return qfalse;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
j = 0;
|
2002-06-16 20:06:15 +00:00
|
|
|
while (*s >= '0' && *s <= '9') {
|
2001-05-06 20:50:27 +00:00
|
|
|
num[j++] = *s++;
|
|
|
|
}
|
|
|
|
num[j] = 0;
|
|
|
|
b[i] = atoi(num);
|
2003-04-19 17:41:26 +00:00
|
|
|
m[i] = 255;
|
2001-05-06 20:50:27 +00:00
|
|
|
if (!*s)
|
|
|
|
break;
|
|
|
|
s++;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
f->mask = *(unsigned *) m;
|
|
|
|
f->compare = *(unsigned *) b;
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
UpdateIPBans
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
static void UpdateIPBans(void)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2003-04-19 17:41:26 +00:00
|
|
|
byte b[4], m[4];
|
|
|
|
int i, j;
|
|
|
|
char iplist_final[MAX_CVAR_VALUE_STRING];
|
|
|
|
char ip[64];
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2003-04-19 17:41:26 +00:00
|
|
|
*iplist_final = 0;
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; i < numIPFilters; i++) {
|
2001-05-06 20:50:27 +00:00
|
|
|
if (ipFilters[i].compare == 0xffffffff)
|
|
|
|
continue;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
*(unsigned *) b = ipFilters[i].compare;
|
2003-04-19 17:41:26 +00:00
|
|
|
*(unsigned *) m = ipFilters[i].mask;
|
|
|
|
*ip = 0;
|
|
|
|
for (j = 0; j < 4; j++) {
|
|
|
|
if (m[j] != 255)
|
|
|
|
Q_strcat(ip, sizeof(ip), "*");
|
|
|
|
else
|
|
|
|
Q_strcat(ip, sizeof(ip), va("%i", b[j]));
|
|
|
|
Q_strcat(ip, sizeof(ip), (j < 3) ? "." : " ");
|
|
|
|
}
|
|
|
|
if (strlen(iplist_final) + strlen(ip) < MAX_CVAR_VALUE_STRING) {
|
|
|
|
Q_strcat(iplist_final, sizeof(iplist_final), ip);
|
|
|
|
} else {
|
|
|
|
Com_Printf("g_banIPs overflowed at MAX_CVAR_VALUE_STRING\n");
|
|
|
|
break;
|
|
|
|
}
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
2003-04-19 17:41:26 +00:00
|
|
|
trap_Cvar_Set("g_banIPs", iplist_final);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
G_FilterPacket
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
qboolean G_FilterPacket(char *from)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
int i;
|
|
|
|
unsigned in;
|
2001-05-06 20:50:27 +00:00
|
|
|
byte m[4];
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
p = from;
|
|
|
|
while (*p && i < 4) {
|
|
|
|
m[i] = 0;
|
|
|
|
while (*p >= '0' && *p <= '9') {
|
2002-06-16 20:06:15 +00:00
|
|
|
m[i] = m[i] * 10 + (*p - '0');
|
2001-05-06 20:50:27 +00:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
if (!*p || *p == ':')
|
|
|
|
break;
|
|
|
|
i++, p++;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
in = *(unsigned *) m;
|
|
|
|
|
|
|
|
for (i = 0; i < numIPFilters; i++)
|
|
|
|
if ((in & ipFilters[i].mask) == ipFilters[i].compare)
|
2001-05-06 20:50:27 +00:00
|
|
|
return g_filterBan.integer != 0;
|
|
|
|
|
|
|
|
return g_filterBan.integer == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
AddIP
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void AddIP(char *str)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
int i;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; i < numIPFilters; i++)
|
2001-05-06 20:50:27 +00:00
|
|
|
if (ipFilters[i].compare == 0xffffffff)
|
2002-06-16 20:06:15 +00:00
|
|
|
break; // free spot
|
|
|
|
if (i == numIPFilters) {
|
|
|
|
if (numIPFilters == MAX_IPFILTERS) {
|
|
|
|
G_Printf("IP filter list is full\n");
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
numIPFilters++;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
|
|
|
|
if (!StringToFilter(str, &ipFilters[i]))
|
2001-05-06 20:50:27 +00:00
|
|
|
ipFilters[i].compare = 0xffffffffu;
|
|
|
|
|
|
|
|
UpdateIPBans();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
G_ProcessIPBans
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void G_ProcessIPBans(void)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
|
|
|
char *s, *t;
|
2003-04-19 17:41:26 +00:00
|
|
|
char str[MAX_CVAR_VALUE_STRING];
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
Q_strncpyz(str, g_banIPs.string, sizeof(str));
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
for (t = s = g_banIPs.string; *t; /* */ ) {
|
|
|
|
s = strchr(s, ' ');
|
|
|
|
if (!s)
|
|
|
|
break;
|
|
|
|
while (*s == ' ')
|
|
|
|
*s++ = 0;
|
|
|
|
if (*t)
|
2002-06-16 20:06:15 +00:00
|
|
|
AddIP(t);
|
2001-05-06 20:50:27 +00:00
|
|
|
t = s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Svcmd_AddIP_f
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void Svcmd_AddIP_f(void)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
char str[MAX_TOKEN_CHARS];
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (trap_Argc() < 2) {
|
2012-10-04 14:30:41 +00:00
|
|
|
G_Printf("Usage: addip <ip-mask>\n");
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Argv(1, str, sizeof(str));
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
AddIP(str);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Svcmd_RemoveIP_f
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void Svcmd_RemoveIP_f(void)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
2002-06-16 20:06:15 +00:00
|
|
|
ipFilter_t f;
|
|
|
|
int i;
|
|
|
|
char str[MAX_TOKEN_CHARS];
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (trap_Argc() < 2) {
|
2012-10-04 14:30:41 +00:00
|
|
|
G_Printf("Usage: removeip <ip-mask>\n");
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Argv(1, str, sizeof(str));
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!StringToFilter(str, &f))
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; i < numIPFilters; i++) {
|
|
|
|
if (ipFilters[i].mask == f.mask && ipFilters[i].compare == f.compare) {
|
2001-05-06 20:50:27 +00:00
|
|
|
ipFilters[i].compare = 0xffffffffu;
|
2002-06-16 20:06:15 +00:00
|
|
|
G_Printf("Removed.\n");
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
UpdateIPBans();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
G_Printf("Didn't find %s.\n", str);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
Svcmd_EntityList_f
|
|
|
|
===================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void Svcmd_EntityList_f(void)
|
|
|
|
{
|
|
|
|
int e;
|
|
|
|
gentity_t *check;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
check = g_entities + 1;
|
|
|
|
for (e = 1; e < level.num_entities; e++, check++) {
|
|
|
|
if (!check->inuse) {
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
G_Printf("%3i:", e);
|
2002-06-16 20:06:15 +00:00
|
|
|
switch (check->s.eType) {
|
2001-05-06 20:50:27 +00:00
|
|
|
case ET_GENERAL:
|
|
|
|
G_Printf("ET_GENERAL ");
|
|
|
|
break;
|
|
|
|
case ET_PLAYER:
|
|
|
|
G_Printf("ET_PLAYER ");
|
|
|
|
break;
|
|
|
|
case ET_ITEM:
|
|
|
|
G_Printf("ET_ITEM ");
|
|
|
|
break;
|
|
|
|
case ET_MISSILE:
|
|
|
|
G_Printf("ET_MISSILE ");
|
|
|
|
break;
|
|
|
|
case ET_MOVER:
|
|
|
|
G_Printf("ET_MOVER ");
|
|
|
|
break;
|
|
|
|
case ET_BEAM:
|
|
|
|
G_Printf("ET_BEAM ");
|
|
|
|
break;
|
|
|
|
case ET_PORTAL:
|
|
|
|
G_Printf("ET_PORTAL ");
|
|
|
|
break;
|
|
|
|
case ET_SPEAKER:
|
|
|
|
G_Printf("ET_SPEAKER ");
|
|
|
|
break;
|
|
|
|
case ET_PUSH_TRIGGER:
|
|
|
|
G_Printf("ET_PUSH_TRIGGER ");
|
|
|
|
break;
|
|
|
|
case ET_TELEPORT_TRIGGER:
|
|
|
|
G_Printf("ET_TELEPORT_TRIGGER ");
|
|
|
|
break;
|
|
|
|
case ET_INVISIBLE:
|
|
|
|
G_Printf("ET_INVISIBLE ");
|
|
|
|
break;
|
|
|
|
case ET_GRAPPLE:
|
|
|
|
G_Printf("ET_GRAPPLE ");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_Printf("%3i ", check->s.eType);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (check->classname) {
|
2001-05-06 20:50:27 +00:00
|
|
|
G_Printf("%s", check->classname);
|
|
|
|
}
|
|
|
|
G_Printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
gclient_t *ClientForString(const char *s)
|
|
|
|
{
|
|
|
|
gclient_t *cl;
|
|
|
|
int i;
|
|
|
|
int idnum;
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
// numeric values are just slot numbers
|
2002-06-16 20:06:15 +00:00
|
|
|
if (s[0] >= '0' && s[0] <= '9') {
|
|
|
|
idnum = atoi(s);
|
|
|
|
if (idnum < 0 || idnum >= level.maxclients) {
|
|
|
|
Com_Printf("Bad client slot: %i\n", idnum);
|
2001-05-06 20:50:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl = &level.clients[idnum];
|
2002-06-16 20:06:15 +00:00
|
|
|
if (cl->pers.connected == CON_DISCONNECTED) {
|
|
|
|
G_Printf("Client %i is not connected\n", idnum);
|
2001-05-06 20:50:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return cl;
|
|
|
|
}
|
|
|
|
// check for a name match
|
2002-06-16 20:06:15 +00:00
|
|
|
for (i = 0; i < level.maxclients; i++) {
|
2001-05-06 20:50:27 +00:00
|
|
|
cl = &level.clients[i];
|
2002-06-16 20:06:15 +00:00
|
|
|
if (cl->pers.connected == CON_DISCONNECTED) {
|
2001-05-06 20:50:27 +00:00
|
|
|
continue;
|
|
|
|
}
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!Q_stricmp(cl->pers.netname, s)) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return cl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
G_Printf("User %s is not on the server\n", s);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
Svcmd_ForceTeam_f
|
|
|
|
|
|
|
|
forceteam <player> <team>
|
|
|
|
===================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
void Svcmd_ForceTeam_f(void)
|
|
|
|
{
|
|
|
|
gclient_t *cl;
|
|
|
|
char str[MAX_TOKEN_CHARS];
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2012-10-04 14:30:41 +00:00
|
|
|
if ( trap_Argc() < 3 ) {
|
|
|
|
G_Printf("Usage: forceteam <player> <team>\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
// find the player
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Argv(1, str, sizeof(str));
|
|
|
|
cl = ClientForString(str);
|
|
|
|
if (!cl) {
|
2001-05-06 20:50:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// set the team
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Argv(2, str, sizeof(str));
|
|
|
|
SetTeam(&g_entities[cl - level.clients], str);
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
char *ConcatArgs(int start);
|
2001-05-06 20:50:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
ConsoleCommand
|
|
|
|
|
|
|
|
=================
|
|
|
|
*/
|
2002-06-16 20:06:15 +00:00
|
|
|
qboolean ConsoleCommand(void)
|
|
|
|
{
|
|
|
|
char cmd[MAX_TOKEN_CHARS];
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_Argv(0, cmd, sizeof(cmd));
|
2001-05-06 20:50:27 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "entitylist") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_EntityList_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "forceteam") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_ForceTeam_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "game_memory") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_GameMem_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "addbot") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_AddBot_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "botlist") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_BotList_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "abort_podium") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_AbortPodium_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "addip") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_AddIP_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "removeip") == 0) {
|
2001-05-06 20:50:27 +00:00
|
|
|
Svcmd_RemoveIP_f();
|
|
|
|
return qtrue;
|
|
|
|
}
|
2002-05-04 16:19:02 +00:00
|
|
|
// JBravo: adding a stuff cmd.
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "stuff") == 0) {
|
2002-05-04 16:19:02 +00:00
|
|
|
RQ3_Cmd_Stuff();
|
|
|
|
return qtrue;
|
|
|
|
}
|
2002-06-10 17:40:52 +00:00
|
|
|
//sLiCeR: adding a clearScores
|
2002-08-02 22:44:37 +00:00
|
|
|
if (Q_stricmp(cmd, "clearscores") == 0 && g_RQ3_matchmode.integer) {
|
|
|
|
MM_ClearScores(qfalse);
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
if (Q_stricmp(cmd, "resetmatch") == 0 && g_RQ3_matchmode.integer) {
|
|
|
|
MM_ResetMatch();
|
2002-06-10 17:40:52 +00:00
|
|
|
return qtrue;
|
|
|
|
}
|
2002-05-04 16:19:02 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "listip") == 0) {
|
|
|
|
trap_SendConsoleCommand(EXEC_NOW, "g_banIPs\n");
|
2001-05-06 20:50:27 +00:00
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2002-06-18 03:57:38 +00:00
|
|
|
if (Q_stricmp(cmd, "cyclemap") == 0 ) {
|
|
|
|
BeginIntermission();
|
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
2001-05-06 20:50:27 +00:00
|
|
|
if (g_dedicated.integer) {
|
2002-06-16 20:06:15 +00:00
|
|
|
if (Q_stricmp(cmd, "say") == 0) {
|
|
|
|
trap_SendServerCommand(-1, va("print \"^1server: %s\n\"", ConcatArgs(1)));
|
2001-05-06 20:50:27 +00:00
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
// everything else will also be printed as a say command
|
2002-06-16 20:06:15 +00:00
|
|
|
trap_SendServerCommand(-1, va("print \"^1server: %s\n\"", ConcatArgs(0)));
|
2001-05-06 20:50:27 +00:00
|
|
|
return qtrue;
|
|
|
|
}
|
|
|
|
|
|
|
|
return qfalse;
|
|
|
|
}
|