2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 cvar_t sv_cheats = {0, "sv_cheats", "0", "enables cheat commands in any game, and cheat impulses in dpmod"};
25 cvar_t rcon_password = {0, "rcon_password", "", "password to authenticate rcon commands"};
26 cvar_t rcon_address = {0, "rcon_address", "", "server address to send rcon commands to (when not connected to a server)"};
27 qboolean allowcheats = false;
35 void Host_Quit_f (void)
46 void Host_Status_f (void)
49 int seconds, minutes, hours = 0, j, players;
50 void (*print) (const char *fmt, ...);
52 if (cmd_source == src_command)
56 Cmd_ForwardToServer ();
62 print = SV_ClientPrintf;
64 for (players = 0, j = 0;j < svs.maxclients;j++)
65 if (svs.clients[j].active)
67 print ("host: %s\n", Cvar_VariableString ("hostname"));
68 print ("version: %s build %s\n", gamename, buildstring);
69 print ("protocol: %i (%s)\n", Protocol_NumberForEnum(sv.protocol), Protocol_NameForEnum(sv.protocol));
70 print ("map: %s\n", sv.name);
71 print ("players: %i active (%i max)\n\n", players, svs.maxclients);
72 for (j = 0, client = svs.clients;j < svs.maxclients;j++, client++)
76 seconds = (int)(realtime - client->connecttime);
77 minutes = seconds / 60;
80 seconds -= (minutes * 60);
83 minutes -= (hours * 60);
87 print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->fields.server->frags, hours, minutes, seconds);
88 print (" %s\n", client->netconnection ? client->netconnection->address : "botclient");
97 Sets client to godmode
100 void Host_God_f (void)
102 if (cmd_source == src_command)
104 Cmd_ForwardToServer ();
110 SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
114 host_client->edict->fields.server->flags = (int)host_client->edict->fields.server->flags ^ FL_GODMODE;
115 if (!((int)host_client->edict->fields.server->flags & FL_GODMODE) )
116 SV_ClientPrint("godmode OFF\n");
118 SV_ClientPrint("godmode ON\n");
121 void Host_Notarget_f (void)
123 if (cmd_source == src_command)
125 Cmd_ForwardToServer ();
131 SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
135 host_client->edict->fields.server->flags = (int)host_client->edict->fields.server->flags ^ FL_NOTARGET;
136 if (!((int)host_client->edict->fields.server->flags & FL_NOTARGET) )
137 SV_ClientPrint("notarget OFF\n");
139 SV_ClientPrint("notarget ON\n");
142 qboolean noclip_anglehack;
144 void Host_Noclip_f (void)
146 if (cmd_source == src_command)
148 Cmd_ForwardToServer ();
154 SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
158 if (host_client->edict->fields.server->movetype != MOVETYPE_NOCLIP)
160 noclip_anglehack = true;
161 host_client->edict->fields.server->movetype = MOVETYPE_NOCLIP;
162 SV_ClientPrint("noclip ON\n");
166 noclip_anglehack = false;
167 host_client->edict->fields.server->movetype = MOVETYPE_WALK;
168 SV_ClientPrint("noclip OFF\n");
176 Sets client to flymode
179 void Host_Fly_f (void)
181 if (cmd_source == src_command)
183 Cmd_ForwardToServer ();
189 SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
193 if (host_client->edict->fields.server->movetype != MOVETYPE_FLY)
195 host_client->edict->fields.server->movetype = MOVETYPE_FLY;
196 SV_ClientPrint("flymode ON\n");
200 host_client->edict->fields.server->movetype = MOVETYPE_WALK;
201 SV_ClientPrint("flymode OFF\n");
212 void Host_Ping_f (void)
216 void (*print) (const char *fmt, ...);
218 if (cmd_source == src_command)
222 Cmd_ForwardToServer ();
228 print = SV_ClientPrintf;
230 print("Client ping times:\n");
231 for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
235 print("%4i %s\n", (int)floor(client->ping*1000+0.5), client->name);
240 ===============================================================================
244 ===============================================================================
248 ======================
253 command from the console. Active clients are kicked off.
254 ======================
256 void Host_Map_f (void)
258 char level[MAX_QPATH];
262 Con_Print("map <levelname> : start a new game (kicks off all players)\n");
266 if (cmd_source != src_command)
269 cls.demonum = -1; // stop demo loop in case this fails
272 Host_ShutdownServer();
274 // remove console or menu
276 key_consoleactive = 0;
278 svs.serverflags = 0; // haven't completed an episode yet
279 allowcheats = sv_cheats.integer != 0;
280 strcpy(level, Cmd_Argv(1));
281 SV_SpawnServer(level);
282 if (sv.active && cls.state == ca_disconnected)
285 CL_EstablishConnection("local:1");
294 Goes to a new map, taking all clients along
297 void Host_Changelevel_f (void)
299 char level[MAX_QPATH];
303 Con_Print("changelevel <levelname> : continue game on a new level\n");
306 if (cls.demoplayback)
308 Con_Print("Only the server may changelevel\n");
316 if (cmd_source != src_command)
319 // remove console or menu
321 key_consoleactive = 0;
324 SV_SaveSpawnparms ();
326 allowcheats = sv_cheats.integer != 0;
327 strcpy(level, Cmd_Argv(1));
328 SV_SpawnServer(level);
329 if (sv.active && cls.state == ca_disconnected)
332 CL_EstablishConnection("local:1");
341 Restarts the current server for a dead player
344 void Host_Restart_f (void)
346 char mapname[MAX_QPATH];
350 Con_Print("restart : restart current level\n");
355 Con_Print("Only the server may restart\n");
358 if (cmd_source != src_command)
361 // remove console or menu
363 key_consoleactive = 0;
365 allowcheats = sv_cheats.integer != 0;
366 strcpy(mapname, sv.name);
367 SV_SpawnServer(mapname);
368 if (sv.active && cls.state == ca_disconnected)
371 CL_EstablishConnection("local:1");
380 This command causes the client to wait for the signon messages again.
381 This is sent just before a server changes levels
384 void Host_Reconnect_f (void)
386 if (cmd_source == src_command)
388 Con_Print("reconnect is not valid from the console\n");
393 Con_Print("reconnect : wait for signon messages again\n");
398 //Con_Print("reconnect: no signon, ignoring reconnect\n");
401 cls.signon = 0; // need new connection messages
405 =====================
408 User command to connect to server
409 =====================
411 void Host_Connect_f (void)
415 Con_Print("connect <serveraddress> : connect to a multiplayer game\n");
420 CL_EstablishConnection(Cmd_Argv(1));
423 CL_EstablishConnection(Cmd_Argv(1));
429 ===============================================================================
433 ===============================================================================
436 #define SAVEGAME_VERSION 5
442 Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
445 void Host_SavegameComment (char *text)
450 for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
452 // LordHavoc: added min() to prevent overflow
453 memcpy (text, cl.levelname, min(strlen(cl.levelname), SAVEGAME_COMMENT_LENGTH));
454 sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
455 memcpy (text+22, kills, strlen(kills));
456 // convert space to _ to make stdio happy
457 // LordHavoc: convert control characters to _ as well
458 for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
461 text[SAVEGAME_COMMENT_LENGTH] = '\0';
470 void Host_Savegame_f (void)
472 char name[MAX_QPATH];
475 char comment[SAVEGAME_COMMENT_LENGTH+1];
477 if (cmd_source != src_command)
480 if (cls.state != ca_connected || !sv.active)
482 Con_Print("Not playing a local game.\n");
488 Con_Print("Can't save in intermission.\n");
492 for (i = 0;i < svs.maxclients;i++)
494 if (svs.clients[i].active)
498 Con_Print("Can't save multiplayer games.\n");
501 if (svs.clients[i].edict->fields.server->deadflag)
503 Con_Print("Can't savegame with a dead player\n");
511 Con_Print("save <savename> : save a game\n");
515 if (strstr(Cmd_Argv(1), ".."))
517 Con_Print("Relative pathnames are not allowed.\n");
521 strlcpy (name, Cmd_Argv(1), sizeof (name));
522 FS_DefaultExtension (name, ".sav", sizeof (name));
524 Con_Printf("Saving game to %s...\n", name);
525 f = FS_Open (name, "wb", false, false);
528 Con_Print("ERROR: couldn't open.\n");
532 FS_Printf(f, "%i\n", SAVEGAME_VERSION);
533 Host_SavegameComment (comment);
534 FS_Printf(f, "%s\n", comment);
535 for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
536 FS_Printf(f, "%f\n", svs.clients[0].spawn_parms[i]);
537 FS_Printf(f, "%d\n", current_skill);
538 FS_Printf(f, "%s\n", sv.name);
539 FS_Printf(f, "%f\n",sv.time);
541 // write the light styles
542 for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
544 if (sv.lightstyles[i][0])
545 FS_Printf(f, "%s\n", sv.lightstyles[i]);
552 PRVM_ED_WriteGlobals (f);
553 for (i=0 ; i<prog->num_edicts ; i++)
554 PRVM_ED_Write (f, PRVM_EDICT_NUM(i));
559 Con_Print("done.\n");
568 void Host_Loadgame_f (void)
570 char filename[MAX_QPATH];
571 char mapname[MAX_QPATH];
581 float spawn_parms[NUM_SPAWN_PARMS];
583 if (cmd_source != src_command)
588 Con_Print("load <savename> : load a game\n");
592 strcpy (filename, Cmd_Argv(1));
593 FS_DefaultExtension (filename, ".sav", sizeof (filename));
595 Con_Printf("Loading game from %s...\n", filename);
597 cls.demonum = -1; // stop demo loop in case this fails
599 t = text = (char *)FS_LoadFile (filename, tempmempool, false, NULL);
602 Con_Print("ERROR: couldn't open.\n");
607 COM_ParseToken(&t, false);
608 version = atoi(com_token);
609 if (version != SAVEGAME_VERSION)
612 Con_Printf("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
617 // this is a little hard to parse, as : is a separator in COM_ParseToken,
618 // so use the console parser instead
619 COM_ParseTokenConsole(&t);
621 for (i = 0;i < NUM_SPAWN_PARMS;i++)
623 COM_ParseToken(&t, false);
624 spawn_parms[i] = atof(com_token);
627 COM_ParseToken(&t, false);
628 // this silliness is so we can load 1.06 save files, which have float skill values
629 current_skill = (int)(atof(com_token) + 0.5);
630 Cvar_SetValue ("skill", (float)current_skill);
633 COM_ParseToken(&t, false);
634 strcpy (mapname, com_token);
637 COM_ParseToken(&t, false);
638 time = atof(com_token);
640 allowcheats = sv_cheats.integer != 0;
642 SV_SpawnServer (mapname);
646 Con_Print("Couldn't load map\n");
649 sv.paused = true; // pause until all clients connect
652 // load the light styles
654 for (i = 0;i < MAX_LIGHTSTYLES;i++)
658 COM_ParseToken(&t, false);
659 // if this is a 64 lightstyle savegame produced by Quake, stop now
660 // we have to check this because darkplaces saves 256 lightstyle savegames
661 if (com_token[0] == '{')
666 strlcpy(sv.lightstyles[i], com_token, sizeof(sv.lightstyles[i]));
669 // now skip everything before the first opening brace
670 // (this is for forward compatibility, so that older versions (at
671 // least ones with this fix) can load savegames with extra data before the
672 // first brace, as might be produced by a later engine version)
676 COM_ParseToken(&t, false);
677 if (com_token[0] == '{')
684 // load the edicts out of the savegame file
691 while (COM_ParseToken(&t, false))
692 if (!strcmp(com_token, "}"))
694 if (!COM_ParseToken(&start, false))
699 if (strcmp(com_token,"{"))
702 Host_Error ("First token isn't a brace");
707 // parse the global vars
708 PRVM_ED_ParseGlobals (start);
713 if (entnum >= MAX_EDICTS)
716 Host_Error("Host_PerformLoadGame: too many edicts in save file (reached MAX_EDICTS %i)", MAX_EDICTS);
718 while (entnum >= prog->max_edicts)
719 //SV_IncreaseEdicts();
720 PRVM_MEM_IncreaseEdicts();
721 ent = PRVM_EDICT_NUM(entnum);
722 memset (ent->fields.server, 0, prog->progs->entityfields * 4);
723 ent->priv.server->free = false;
724 PRVM_ED_ParseEdict (start, ent);
726 // link it into the bsp tree
727 if (!ent->priv.server->free)
728 SV_LinkEdict (ent, false);
734 prog->num_edicts = entnum;
737 for (i = 0;i < NUM_SPAWN_PARMS;i++)
738 svs.clients[0].spawn_parms[i] = spawn_parms[i];
740 // make sure we're connected to loopback
741 if (cls.state == ca_disconnected || !(cls.state == ca_connected && cls.netcon != NULL && LHNETADDRESS_GetAddressType(&cls.netcon->peeraddress) == LHNETADDRESSTYPE_LOOP))
742 CL_EstablishConnection("local:1");
747 //============================================================================
750 ======================
752 ======================
754 cvar_t cl_name = {CVAR_SAVE, "_cl_name", "player", "internal storage cvar for current player name (changed by name command)"};
755 void Host_Name_f (void)
758 char newName[sizeof(host_client->name)];
760 if (Cmd_Argc () == 1)
762 Con_Printf("\"name\" is \"%s\"\n", cl_name.string);
766 if (Cmd_Argc () == 2)
767 strlcpy (newName, Cmd_Argv(1), sizeof (newName));
769 strlcpy (newName, Cmd_Args(), sizeof (newName));
771 for (i = 0, j = 0;newName[i];i++)
772 if (newName[i] != '\r' && newName[i] != '\n')
773 newName[j++] = newName[i];
776 if (cmd_source == src_command)
778 Cvar_Set ("_cl_name", newName);
779 if (cls.state == ca_connected)
780 Cmd_ForwardToServer ();
784 if (sv.time < host_client->nametime)
786 SV_ClientPrintf("You can't change name more than once every 5 seconds!\n");
790 host_client->nametime = sv.time + 5;
792 // point the string back at updateclient->name to keep it safe
794 strlcpy (host_client->name, newName, sizeof (host_client->name));
795 host_client->edict->fields.server->netname = PRVM_SetEngineString(host_client->name);
796 if (strcmp(host_client->old_name, host_client->name))
798 if (host_client->spawned)
799 SV_BroadcastPrintf("%s changed name to %s\n", host_client->old_name, host_client->name);
800 strcpy(host_client->old_name, host_client->name);
801 // send notification to all clients
802 MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
803 MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
804 MSG_WriteString (&sv.reliable_datagram, host_client->name);
810 ======================
812 ======================
814 cvar_t cl_playermodel = {CVAR_SAVE, "_cl_playermodel", "", "internal storage cvar for current player model in Nexuiz (changed by playermodel command)"};
815 // the old cl_playermodel in cl_main has been renamed to __cl_playermodel
816 void Host_Playermodel_f (void)
819 char newPath[sizeof(host_client->playermodel)];
821 if (Cmd_Argc () == 1)
823 Con_Printf("\"playermodel\" is \"%s\"\n", cl_playermodel.string);
827 if (Cmd_Argc () == 2)
828 strlcpy (newPath, Cmd_Argv(1), sizeof (newPath));
830 strlcpy (newPath, Cmd_Args(), sizeof (newPath));
832 for (i = 0, j = 0;newPath[i];i++)
833 if (newPath[i] != '\r' && newPath[i] != '\n')
834 newPath[j++] = newPath[i];
837 if (cmd_source == src_command)
839 Cvar_Set ("_cl_playermodel", newPath);
840 if (cls.state == ca_connected)
841 Cmd_ForwardToServer ();
846 if (sv.time < host_client->nametime)
848 SV_ClientPrintf("You can't change playermodel more than once every 5 seconds!\n");
852 host_client->nametime = sv.time + 5;
856 // point the string back at updateclient->name to keep it safe
857 strlcpy (host_client->playermodel, newPath, sizeof (host_client->playermodel));
858 if( eval_playermodel )
859 PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PRVM_SetEngineString(host_client->playermodel);
860 if (strcmp(host_client->old_model, host_client->playermodel))
862 strcpy(host_client->old_model, host_client->playermodel);
863 /*// send notification to all clients
864 MSG_WriteByte (&sv.reliable_datagram, svc_updatepmodel);
865 MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
866 MSG_WriteString (&sv.reliable_datagram, host_client->playermodel);*/
872 ======================
874 ======================
876 cvar_t cl_playerskin = {CVAR_SAVE, "_cl_playerskin", "", "internal storage cvar for current player skin in Nexuiz (changed by playerskin command)"};
877 void Host_Playerskin_f (void)
880 char newPath[sizeof(host_client->playerskin)];
882 if (Cmd_Argc () == 1)
884 Con_Printf("\"playerskin\" is \"%s\"\n", cl_playerskin.string);
888 if (Cmd_Argc () == 2)
889 strlcpy (newPath, Cmd_Argv(1), sizeof (newPath));
891 strlcpy (newPath, Cmd_Args(), sizeof (newPath));
893 for (i = 0, j = 0;newPath[i];i++)
894 if (newPath[i] != '\r' && newPath[i] != '\n')
895 newPath[j++] = newPath[i];
898 if (cmd_source == src_command)
900 Cvar_Set ("_cl_playerskin", newPath);
901 if (cls.state == ca_connected)
902 Cmd_ForwardToServer ();
907 if (sv.time < host_client->nametime)
909 SV_ClientPrintf("You can't change playermodel more than once every 5 seconds!\n");
913 host_client->nametime = sv.time + 5;
917 // point the string back at updateclient->name to keep it safe
918 strlcpy (host_client->playerskin, newPath, sizeof (host_client->playerskin));
919 if( eval_playerskin )
920 PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string = PRVM_SetEngineString(host_client->playerskin);
921 if (strcmp(host_client->old_skin, host_client->playerskin))
923 if (host_client->spawned)
924 SV_BroadcastPrintf("%s changed skin to %s\n", host_client->name, host_client->playerskin);
925 strcpy(host_client->old_skin, host_client->playerskin);
926 /*// send notification to all clients
927 MSG_WriteByte (&sv.reliable_datagram, svc_updatepskin);
928 MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
929 MSG_WriteString (&sv.reliable_datagram, host_client->playerskin);*/
934 void Host_Version_f (void)
936 Con_Printf("Version: %s build %s\n", gamename, buildstring);
939 void Host_Say(qboolean teamonly)
945 // LordHavoc: long say messages
947 qboolean fromServer = false;
949 if (cmd_source == src_command)
951 if (cls.state == ca_dedicated)
958 Cmd_ForwardToServer ();
966 if (!teamplay.integer)
969 // turn on color set 1
978 dpsnprintf (text, sizeof(text), "%c%s" STRING_COLOR_DEFAULT_STR ": %s", 1, host_client->name, p1);
980 dpsnprintf (text, sizeof(text), "%c<%s" STRING_COLOR_DEFAULT_STR "> %s", 1, hostname.string, p1);
981 p2 = text + strlen(text);
982 while ((const char *)p2 > (const char *)text && (p2[-1] == '\r' || p2[-1] == '\n' || (p2[-1] == '\"' && quoted)))
984 if (p2[-1] == '\"' && quoted)
989 strlcat(text, "\n", sizeof(text));
991 // note: save is not a valid edict if fromServer is true
993 for (j = 0, host_client = svs.clients;j < svs.maxclients;j++, host_client++)
994 if (host_client->spawned && (!teamonly || host_client->edict->fields.server->team == save->edict->fields.server->team))
995 SV_ClientPrint(text);
998 if (cls.state == ca_dedicated)
1003 void Host_Say_f(void)
1009 void Host_Say_Team_f(void)
1015 void Host_Tell_f(void)
1019 const char *p1, *p2;
1020 char text[MAX_INPUTLINE]; // LordHavoc: FIXME: temporary buffer overflow fix (was 64)
1021 qboolean fromServer = false;
1023 if (cmd_source == src_command)
1025 if (cls.state == ca_dedicated)
1029 Cmd_ForwardToServer ();
1034 if (Cmd_Argc () < 3)
1038 sprintf (text, "%s: ", host_client->name);
1040 sprintf (text, "<%s> ", hostname.string);
1043 p2 = p1 + strlen(p1);
1044 // remove the target name
1045 while (p1 < p2 && *p1 != ' ')
1047 while (p1 < p2 && *p1 == ' ')
1049 // remove trailing newlines
1050 while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
1052 // remove quotes if present
1058 else if (fromServer)
1059 Con_Print("Host_Tell: missing end quote\n");
1061 SV_ClientPrint("Host_Tell: missing end quote\n");
1063 while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
1065 for (j = (int)strlen(text);j < (int)(sizeof(text) - 2) && p1 < p2;)
1071 for (j = 0, host_client = svs.clients;j < svs.maxclients;j++, host_client++)
1072 if (host_client->spawned && !strcasecmp(host_client->name, Cmd_Argv(1)))
1073 SV_ClientPrint(text);
1083 cvar_t cl_color = {CVAR_SAVE, "_cl_color", "0", "internal storage cvar for current player colors (changed by color command)"};
1084 void Host_Color_f(void)
1089 func_t SV_ChangeTeam;
1091 if (Cmd_Argc() == 1)
1093 Con_Printf("\"color\" is \"%i %i\"\n", cl_color.integer >> 4, cl_color.integer & 15);
1094 Con_Print("color <0-15> [0-15]\n");
1098 if (Cmd_Argc() == 2)
1099 top = bottom = atoi(Cmd_Argv(1));
1102 top = atoi(Cmd_Argv(1));
1103 bottom = atoi(Cmd_Argv(2));
1107 // LordHavoc: allow skin colormaps 14 and 15 (was 13)
1111 // LordHavoc: allow skin colormaps 14 and 15 (was 13)
1115 playercolor = top*16 + bottom;
1117 if (cmd_source == src_command)
1119 Cvar_SetValue ("_cl_color", playercolor);
1120 if (cls.state == ca_connected)
1121 Cmd_ForwardToServer ();
1126 if (host_client->edict && (f = PRVM_ED_FindFunction ("SV_ChangeTeam")) && (SV_ChangeTeam = (func_t)(f - prog->functions)))
1128 Con_DPrint("Calling SV_ChangeTeam\n");
1129 prog->globals.server->time = sv.time;
1130 prog->globals.generic[OFS_PARM0] = playercolor;
1131 prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
1132 PRVM_ExecuteProgram (SV_ChangeTeam, "QC function SV_ChangeTeam is missing");
1137 if (host_client->edict)
1139 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_clientcolors)))
1140 val->_float = playercolor;
1141 host_client->edict->fields.server->team = bottom + 1;
1143 host_client->colors = playercolor;
1144 if (host_client->old_colors != host_client->colors)
1146 host_client->old_colors = host_client->colors;
1147 // send notification to all clients
1148 MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
1149 MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
1150 MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
1156 cvar_t cl_rate = {CVAR_SAVE, "_cl_rate", "10000", "internal storage cvar for current rate (changed by rate command)"};
1157 void Host_Rate_f(void)
1161 if (Cmd_Argc() != 2)
1163 Con_Printf("\"rate\" is \"%i\"\n", cl_rate.integer);
1164 Con_Print("rate <500-25000>\n");
1168 rate = atoi(Cmd_Argv(1));
1170 if (cmd_source == src_command)
1172 Cvar_SetValue ("_cl_rate", bound(NET_MINRATE, rate, NET_MAXRATE));
1173 if (cls.state == ca_connected)
1174 Cmd_ForwardToServer ();
1178 host_client->rate = rate;
1186 void Host_Kill_f (void)
1188 if (cmd_source == src_command)
1190 Cmd_ForwardToServer ();
1194 if (host_client->edict->fields.server->health <= 0)
1196 SV_ClientPrint("Can't suicide -- already dead!\n");
1201 prog->globals.server->time = sv.time;
1202 prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
1203 PRVM_ExecuteProgram (prog->globals.server->ClientKill, "QC function ClientKill is missing");
1213 void Host_Pause_f (void)
1216 if (cmd_source == src_command)
1218 Cmd_ForwardToServer ();
1221 if (!pausable.integer)
1222 SV_ClientPrint("Pause not allowed.\n");
1226 SV_BroadcastPrintf("%s %spaused the game\n", host_client->name, sv.paused ? "" : "un");
1227 // send notification to all clients
1228 MSG_WriteByte(&sv.reliable_datagram, svc_setpause);
1229 MSG_WriteByte(&sv.reliable_datagram, sv.paused);
1234 ======================
1236 LordHavoc: only supported for Nehahra, I personally think this is dumb, but Mindcrime won't listen.
1237 LordHavoc: correction, Mindcrime will be removing pmodel in the future, but it's still stuck here for compatibility.
1238 ======================
1240 cvar_t cl_pmodel = {CVAR_SAVE, "_cl_pmodel", "0", "internal storage cvar for current player model number in nehahra (changed by pmodel command)"};
1241 static void Host_PModel_f (void)
1246 if (Cmd_Argc () == 1)
1248 Con_Printf("\"pmodel\" is \"%s\"\n", cl_pmodel.string);
1251 i = atoi(Cmd_Argv(1));
1253 if (cmd_source == src_command)
1255 if (cl_pmodel.integer == i)
1257 Cvar_SetValue ("_cl_pmodel", i);
1258 if (cls.state == ca_connected)
1259 Cmd_ForwardToServer ();
1264 if (host_client->edict && (val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_pmodel)))
1269 //===========================================================================
1277 void Host_PreSpawn_f (void)
1279 if (cmd_source == src_command)
1281 Con_Print("prespawn is not valid from the console\n");
1285 if (host_client->spawned)
1287 Con_Print("prespawn not valid -- already spawned\n");
1291 if (host_client->netconnection)
1293 SZ_Write (&host_client->netconnection->message, sv.signon.data, sv.signon.cursize);
1294 MSG_WriteByte (&host_client->netconnection->message, svc_signonnum);
1295 MSG_WriteByte (&host_client->netconnection->message, 2);
1298 // reset the name change timer because the client will send name soon
1299 host_client->nametime = 0;
1307 void Host_Spawn_f (void)
1313 int stats[MAX_CL_STATS];
1315 if (cmd_source == src_command)
1317 Con_Print("spawn is not valid from the console\n");
1321 if (host_client->spawned)
1323 Con_Print("Spawn not valid -- already spawned\n");
1327 // reset name change timer again because they might want to change name
1328 // again in the first 5 seconds after connecting
1329 host_client->nametime = 0;
1331 // LordHavoc: moved this above the QC calls at FrikaC's request
1332 // LordHavoc: commented this out
1333 //if (host_client->netconnection)
1334 // SZ_Clear (&host_client->netconnection->message);
1336 // run the entrance script
1340 // loaded games are fully initialized already
1341 // if this is the last client to be connected, unpause
1344 if ((f = PRVM_ED_FindFunction ("RestoreGame")))
1345 if ((RestoreGame = (func_t)(f - prog->functions)))
1347 Con_DPrint("Calling RestoreGame\n");
1348 prog->globals.server->time = sv.time;
1349 prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
1350 PRVM_ExecuteProgram (RestoreGame, "QC function RestoreGame is missing");
1355 //Con_Printf("Host_Spawn_f: host_client->edict->netname = %s, host_client->edict->netname = %s, host_client->name = %s\n", PRVM_GetString(host_client->edict->fields.server->netname), PRVM_GetString(host_client->edict->fields.server->netname), host_client->name);
1357 // copy spawn parms out of the client_t
1358 for (i=0 ; i< NUM_SPAWN_PARMS ; i++)
1359 (&prog->globals.server->parm1)[i] = host_client->spawn_parms[i];
1361 // call the spawn function
1362 host_client->clientconnectcalled = true;
1363 prog->globals.server->time = sv.time;
1364 prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
1365 PRVM_ExecuteProgram (prog->globals.server->ClientConnect, "QC function ClientConnect is missing");
1367 if ((Sys_DoubleTime() - host_client->connecttime) <= sv.time)
1368 Con_Printf("%s entered the game\n", host_client->name);
1370 PRVM_ExecuteProgram (prog->globals.server->PutClientInServer, "QC function PutClientInServer is missing");
1374 if (!host_client->netconnection)
1378 // send time of update
1379 MSG_WriteByte (&host_client->netconnection->message, svc_time);
1380 MSG_WriteFloat (&host_client->netconnection->message, sv.time);
1382 // send all current names, colors, and frag counts
1383 for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
1385 if (!client->active)
1387 MSG_WriteByte (&host_client->netconnection->message, svc_updatename);
1388 MSG_WriteByte (&host_client->netconnection->message, i);
1389 MSG_WriteString (&host_client->netconnection->message, client->name);
1390 MSG_WriteByte (&host_client->netconnection->message, svc_updatefrags);
1391 MSG_WriteByte (&host_client->netconnection->message, i);
1392 MSG_WriteShort (&host_client->netconnection->message, client->frags);
1393 MSG_WriteByte (&host_client->netconnection->message, svc_updatecolors);
1394 MSG_WriteByte (&host_client->netconnection->message, i);
1395 MSG_WriteByte (&host_client->netconnection->message, client->colors);
1398 // send all current light styles
1399 for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
1401 if (sv.lightstyles[i][0])
1403 MSG_WriteByte (&host_client->netconnection->message, svc_lightstyle);
1404 MSG_WriteByte (&host_client->netconnection->message, (char)i);
1405 MSG_WriteString (&host_client->netconnection->message, sv.lightstyles[i]);
1410 MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
1411 MSG_WriteByte (&host_client->netconnection->message, STAT_TOTALSECRETS);
1412 MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->total_secrets);
1414 MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
1415 MSG_WriteByte (&host_client->netconnection->message, STAT_TOTALMONSTERS);
1416 MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->total_monsters);
1418 MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
1419 MSG_WriteByte (&host_client->netconnection->message, STAT_SECRETS);
1420 MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->found_secrets);
1422 MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
1423 MSG_WriteByte (&host_client->netconnection->message, STAT_MONSTERS);
1424 MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->killed_monsters);
1427 // Never send a roll angle, because savegames can catch the server
1428 // in a state where it is expecting the client to correct the angle
1429 // and it won't happen if the game was just loaded, so you wind up
1430 // with a permanent head tilt
1431 MSG_WriteByte (&host_client->netconnection->message, svc_setangle);
1432 MSG_WriteAngle (&host_client->netconnection->message, host_client->edict->fields.server->angles[0], sv.protocol);
1433 MSG_WriteAngle (&host_client->netconnection->message, host_client->edict->fields.server->angles[1], sv.protocol);
1434 MSG_WriteAngle (&host_client->netconnection->message, 0, sv.protocol);
1436 SV_WriteClientdataToMessage (host_client, host_client->edict, &host_client->netconnection->message, stats);
1438 MSG_WriteByte (&host_client->netconnection->message, svc_signonnum);
1439 MSG_WriteByte (&host_client->netconnection->message, 3);
1448 void Host_Begin_f (void)
1450 if (cmd_source == src_command)
1452 Con_Print("begin is not valid from the console\n");
1456 host_client->spawned = true;
1459 //===========================================================================
1466 Kicks a user off of the server
1469 void Host_Kick_f (void)
1472 const char *message = NULL;
1475 qboolean byNumber = false;
1477 if (cmd_source != src_command || !sv.active)
1483 if (Cmd_Argc() > 2 && strcmp(Cmd_Argv(1), "#") == 0)
1485 i = atof(Cmd_Argv(2)) - 1;
1486 if (i < 0 || i >= svs.maxclients || !(host_client = svs.clients + i)->active)
1492 for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
1494 if (!host_client->active)
1496 if (strcasecmp(host_client->name, Cmd_Argv(1)) == 0)
1501 if (i < svs.maxclients)
1503 if (cmd_source == src_command)
1505 if (cls.state == ca_dedicated)
1508 who = cl_name.string;
1513 // can't kick yourself!
1514 if (host_client == save)
1519 message = Cmd_Args();
1520 COM_ParseToken(&message, false);
1523 message++; // skip the #
1524 while (*message == ' ') // skip white space
1526 message += strlen(Cmd_Argv(2)); // skip the number
1528 while (*message && *message == ' ')
1532 SV_ClientPrintf("Kicked by %s: %s\n", who, message);
1534 SV_ClientPrintf("Kicked by %s\n", who);
1535 SV_DropClient (false); // kicked
1543 ===============================================================================
1547 ===============================================================================
1555 void Host_Give_f (void)
1561 if (cmd_source == src_command)
1563 Cmd_ForwardToServer ();
1569 SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
1574 v = atoi (Cmd_Argv(2));
1589 // MED 01/04/97 added hipnotic give stuff
1590 if (gamemode == GAME_HIPNOTIC)
1595 host_client->edict->fields.server->items = (int)host_client->edict->fields.server->items | HIT_PROXIMITY_GUN;
1597 host_client->edict->fields.server->items = (int)host_client->edict->fields.server->items | IT_GRENADE_LAUNCHER;
1599 else if (t[0] == '9')
1600 host_client->edict->fields.server->items = (int)host_client->edict->fields.server->items | HIT_LASER_CANNON;
1601 else if (t[0] == '0')
1602 host_client->edict->fields.server->items = (int)host_client->edict->fields.server->items | HIT_MJOLNIR;
1603 else if (t[0] >= '2')
1604 host_client->edict->fields.server->items = (int)host_client->edict->fields.server->items | (IT_SHOTGUN << (t[0] - '2'));
1609 host_client->edict->fields.server->items = (int)host_client->edict->fields.server->items | (IT_SHOTGUN << (t[0] - '2'));
1614 if (gamemode == GAME_ROGUE && (val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ammo_shells1)))
1617 host_client->edict->fields.server->ammo_shells = v;
1620 if (gamemode == GAME_ROGUE)
1622 if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ammo_nails1)))
1625 if (host_client->edict->fields.server->weapon <= IT_LIGHTNING)
1626 host_client->edict->fields.server->ammo_nails = v;
1631 host_client->edict->fields.server->ammo_nails = v;
1635 if (gamemode == GAME_ROGUE)
1637 val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ammo_lava_nails);
1641 if (host_client->edict->fields.server->weapon > IT_LIGHTNING)
1642 host_client->edict->fields.server->ammo_nails = v;
1647 if (gamemode == GAME_ROGUE)
1649 val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ammo_rockets1);
1653 if (host_client->edict->fields.server->weapon <= IT_LIGHTNING)
1654 host_client->edict->fields.server->ammo_rockets = v;
1659 host_client->edict->fields.server->ammo_rockets = v;
1663 if (gamemode == GAME_ROGUE)
1665 val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ammo_multi_rockets);
1669 if (host_client->edict->fields.server->weapon > IT_LIGHTNING)
1670 host_client->edict->fields.server->ammo_rockets = v;
1675 host_client->edict->fields.server->health = v;
1678 if (gamemode == GAME_ROGUE)
1680 val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ammo_cells1);
1684 if (host_client->edict->fields.server->weapon <= IT_LIGHTNING)
1685 host_client->edict->fields.server->ammo_cells = v;
1690 host_client->edict->fields.server->ammo_cells = v;
1694 if (gamemode == GAME_ROGUE)
1696 val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ammo_plasma);
1700 if (host_client->edict->fields.server->weapon > IT_LIGHTNING)
1701 host_client->edict->fields.server->ammo_cells = v;
1709 prvm_edict_t *FindViewthing (void)
1714 for (i=0 ; i<prog->num_edicts ; i++)
1716 e = PRVM_EDICT_NUM(i);
1717 if (!strcmp (PRVM_GetString(e->fields.server->classname), "viewthing"))
1720 Con_Print("No viewthing on map\n");
1729 void Host_Viewmodel_f (void)
1738 e = FindViewthing ();
1743 m = Mod_ForName (Cmd_Argv(1), false, true, false);
1744 if (!m || !m->loaded || !m->Draw)
1746 Con_Printf("viewmodel: can't load %s\n", Cmd_Argv(1));
1750 e->fields.server->frame = 0;
1751 cl.model_precache[(int)e->fields.server->modelindex] = m;
1759 void Host_Viewframe_f (void)
1769 e = FindViewthing ();
1773 m = cl.model_precache[(int)e->fields.server->modelindex];
1775 f = atoi(Cmd_Argv(1));
1776 if (f >= m->numframes)
1779 e->fields.server->frame = f;
1783 void PrintFrameName (model_t *m, int frame)
1786 Con_Printf("frame %i: %s\n", frame, m->animscenes[frame].name);
1788 Con_Printf("frame %i\n", frame);
1796 void Host_Viewnext_f (void)
1805 e = FindViewthing ();
1809 m = cl.model_precache[(int)e->fields.server->modelindex];
1811 e->fields.server->frame = e->fields.server->frame + 1;
1812 if (e->fields.server->frame >= m->numframes)
1813 e->fields.server->frame = m->numframes - 1;
1815 PrintFrameName (m, e->fields.server->frame);
1823 void Host_Viewprev_f (void)
1832 e = FindViewthing ();
1837 m = cl.model_precache[(int)e->fields.server->modelindex];
1839 e->fields.server->frame = e->fields.server->frame - 1;
1840 if (e->fields.server->frame < 0)
1841 e->fields.server->frame = 0;
1843 PrintFrameName (m, e->fields.server->frame);
1847 ===============================================================================
1851 ===============================================================================
1860 void Host_Startdemos_f (void)
1864 if (cls.state == ca_dedicated || COM_CheckParm("-listen") || COM_CheckParm("-benchmark") || COM_CheckParm("-demo") || COM_CheckParm("-demolooponly"))
1870 Con_Printf("Max %i demos in demoloop\n", MAX_DEMOS);
1873 Con_Printf("%i demo(s) in loop\n", c);
1875 for (i=1 ; i<c+1 ; i++)
1876 strlcpy (cls.demos[i-1], Cmd_Argv(i), sizeof (cls.demos[i-1]));
1878 // LordHavoc: clear the remaining slots
1879 for (;i <= MAX_DEMOS;i++)
1880 cls.demos[i-1][0] = 0;
1882 if (!sv.active && cls.demonum != -1 && !cls.demoplayback)
1896 Return to looping demos
1899 void Host_Demos_f (void)
1901 if (cls.state == ca_dedicated)
1903 if (cls.demonum == -1)
1913 Return to looping demos
1916 void Host_Stopdemo_f (void)
1918 if (!cls.demoplayback)
1921 Host_ShutdownServer ();
1924 void Host_SendCvar_f (void)
1932 if(!(c = Cvar_FindVar(Cmd_Argv(1))))
1934 if (cls.state != ca_dedicated)
1935 Cmd_ForwardStringToServer(va("sentcvar %s %s\n", c->name, c->string));
1936 if(!sv.active)// || !SV_ParseClientCommandQC)
1940 if (cls.state != ca_dedicated)
1944 for(;i<svs.maxclients;i++)
1945 if(svs.clients[i].active && svs.clients[i].netconnection)
1947 host_client = &svs.clients[i];
1948 Host_ClientCommands(va("sendcvar %s\n", c->name));
1953 static void MaxPlayers_f(void)
1957 if (Cmd_Argc() != 2)
1959 Con_Printf("\"maxplayers\" is \"%u\"\n", svs.maxclients);
1965 Con_Print("maxplayers can not be changed while a server is running.\n");
1969 n = atoi(Cmd_Argv(1));
1970 n = bound(1, n, MAX_SCOREBOARD);
1971 Con_Printf("\"maxplayers\" set to \"%u\"\n", n);
1974 Mem_Free(svs.clients);
1976 svs.clients = (client_t *)Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
1978 Cvar_Set ("deathmatch", "0");
1980 Cvar_Set ("deathmatch", "1");
1983 //=============================================================================
1985 // QuakeWorld commands
1987 char emodel_name[] =
1988 { 'e' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff, 0 };
1989 char pmodel_name[] =
1990 { 'p' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff, 0 };
1991 char prespawn_name[] =
1992 { 'p'^0xff, 'r'^0xff, 'e'^0xff, 's'^0xff, 'p'^0xff, 'a'^0xff, 'w'^0xff, 'n'^0xff,
1993 ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '0'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
1994 char modellist_name[] =
1995 { 'm'^0xff, 'o'^0xff, 'd'^0xff, 'e'^0xff, 'l'^0xff, 'l'^0xff, 'i'^0xff, 's'^0xff, 't'^0xff,
1996 ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
1997 char soundlist_name[] =
1998 { 's'^0xff, 'o'^0xff, 'u'^0xff, 'n'^0xff, 'd'^0xff, 'l'^0xff, 'i'^0xff, 's'^0xff, 't'^0xff,
1999 ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
2002 =====================
2005 Send the rest of the command line over as
2006 an unconnected command.
2007 =====================
2009 void Host_Rcon_f (void) // credit: taken from QuakeWorld
2012 lhnetsocket_t *mysocket;
2014 if (!rcon_password.string)
2016 Con_Printf ("You must set rcon_password before issuing an rcon command.\n");
2021 to = cls.netcon->peeraddress;
2024 if (!rcon_address.integer || !rcon_address.string[0])
2026 Con_Printf ("You must either be connected, or set the rcon_address cvar to issue rcon commands\n");
2029 LHNETADDRESS_FromString(&to, rcon_address.string, sv_netport.integer);
2031 mysocket = NetConn_ChooseClientSocketForAddress(&to);
2034 // simply put together the rcon packet and send it
2035 NetConn_WriteString(mysocket, va("\377\377\377\377rcon %s %s", rcon_password.string, Cmd_Args()), &to);
2040 ====================
2043 packet <destination> <contents>
2045 Contents allows \n escape character
2046 ====================
2048 void Host_Packet_f (void) // credit: taken from QuakeWorld
2054 lhnetaddress_t address;
2055 lhnetsocket_t *mysocket;
2057 if (Cmd_Argc() != 3)
2059 Con_Printf ("packet <destination> <contents>\n");
2063 if (!LHNETADDRESS_FromString (&address, Cmd_Argv(1), sv_netport.integer))
2065 Con_Printf ("Bad address\n");
2071 send[0] = send[1] = send[2] = send[3] = 0xff;
2074 for (i=0 ; i<l ; i++)
2076 if (out >= send + sizeof(send) - 1)
2078 if (in[i] == '\\' && in[i+1] == 'n')
2088 mysocket = NetConn_ChooseClientSocketForAddress(&address);
2090 NetConn_WriteString(mysocket, send, &address);
2093 //=============================================================================
2100 void Host_InitCommands (void)
2102 Cmd_AddCommand ("status", Host_Status_f, "print server status information");
2103 Cmd_AddCommand ("quit", Host_Quit_f, "quit the game");
2104 if (gamemode == GAME_NEHAHRA)
2106 Cmd_AddCommand ("max", Host_God_f, "god mode (invulnerability)");
2107 Cmd_AddCommand ("monster", Host_Notarget_f, "notarget mode (monsters do not see you)");
2108 Cmd_AddCommand ("scrag", Host_Fly_f, "fly mode (flight)");
2109 Cmd_AddCommand ("wraith", Host_Noclip_f, "noclip mode (flight without collisions, move through walls)");
2110 Cmd_AddCommand ("gimme", Host_Give_f, "alter inventory");
2114 Cmd_AddCommand ("god", Host_God_f, "god mode (invulnerability)");
2115 Cmd_AddCommand ("notarget", Host_Notarget_f, "notarget mode (monsters do not see you)");
2116 Cmd_AddCommand ("fly", Host_Fly_f, "fly mode (flight)");
2117 Cmd_AddCommand ("noclip", Host_Noclip_f, "noclip mode (flight without collisions, move through walls)");
2118 Cmd_AddCommand ("give", Host_Give_f, "alter inventory");
2120 Cmd_AddCommand ("map", Host_Map_f, "kick everyone off the server and start a new level");
2121 Cmd_AddCommand ("restart", Host_Restart_f, "restart current level");
2122 Cmd_AddCommand ("changelevel", Host_Changelevel_f, "change to another level, bringing along all connected clients");
2123 Cmd_AddCommand ("connect", Host_Connect_f, "connect to a server by IP address or hostname");
2124 Cmd_AddCommand ("reconnect", Host_Reconnect_f, "reset signon level in preparation for a new level (do not use)");
2125 Cmd_AddCommand ("version", Host_Version_f, "print engine version");
2126 Cmd_AddCommand ("say", Host_Say_f, "send a chat message to everyone on the server");
2127 Cmd_AddCommand ("say_team", Host_Say_Team_f, "send a chat message to your team on the server");
2128 Cmd_AddCommand ("tell", Host_Tell_f, "send a chat message to only one person on the server");
2129 Cmd_AddCommand ("kill", Host_Kill_f, "die instantly");
2130 Cmd_AddCommand ("pause", Host_Pause_f, "pause the game (if the server allows pausing)");
2131 Cmd_AddCommand ("kick", Host_Kick_f, "kick a player off the server by number or name");
2132 Cmd_AddCommand ("ping", Host_Ping_f, "print ping times of all players on the server");
2133 Cmd_AddCommand ("load", Host_Loadgame_f, "load a saved game file");
2134 Cmd_AddCommand ("save", Host_Savegame_f, "save the game to a file");
2136 Cmd_AddCommand ("startdemos", Host_Startdemos_f, "start playing back the selected demos sequentially (used at end of startup script)");
2137 Cmd_AddCommand ("demos", Host_Demos_f, "restart looping demos defined by the last startdemos command");
2138 Cmd_AddCommand ("stopdemo", Host_Stopdemo_f, "stop playing or recording demo (like stop command) and return to looping demos");
2140 Cmd_AddCommand ("viewmodel", Host_Viewmodel_f, "change model of viewthing entity in current level");
2141 Cmd_AddCommand ("viewframe", Host_Viewframe_f, "change animation frame of viewthing entity in current level");
2142 Cmd_AddCommand ("viewnext", Host_Viewnext_f, "change to next animation frame of viewthing entity in current level");
2143 Cmd_AddCommand ("viewprev", Host_Viewprev_f, "change to previous animation frame of viewthing entity in current level");
2145 Cvar_RegisterVariable (&cl_name);
2146 Cmd_AddCommand ("name", Host_Name_f, "change your player name");
2147 Cvar_RegisterVariable (&cl_color);
2148 Cmd_AddCommand ("color", Host_Color_f, "change your player shirt and pants colors");
2149 Cvar_RegisterVariable (&cl_rate);
2150 Cmd_AddCommand ("rate", Host_Rate_f, "change your network connection speed");
2151 if (gamemode == GAME_NEHAHRA)
2153 Cvar_RegisterVariable (&cl_pmodel);
2154 Cmd_AddCommand ("pmodel", Host_PModel_f, "change your player model choice (Nehahra specific)");
2157 // BLACK: This isnt game specific anymore (it was GAME_NEXUIZ at first)
2158 Cvar_RegisterVariable (&cl_playermodel);
2159 Cmd_AddCommand ("playermodel", Host_Playermodel_f, "change your player model");
2160 Cvar_RegisterVariable (&cl_playerskin);
2161 Cmd_AddCommand ("playerskin", Host_Playerskin_f, "change your player skin number");
2163 Cmd_AddCommand ("prespawn", Host_PreSpawn_f, "signon 1 (client acknowledges that server information has been received)");
2164 Cmd_AddCommand ("spawn", Host_Spawn_f, "signon 2 (client has sent player information, and is asking server to send scoreboard rankings)");
2165 Cmd_AddCommand ("begin", Host_Begin_f, "signon 3 (client asks server to start sending entities, and will go to signon 4 (playing) when the first entity update is received)");
2166 Cmd_AddCommand ("maxplayers", MaxPlayers_f, "sets limit on how many players (or bots) may be connected to the server at once");
2168 Cmd_AddCommand ("sendcvar", Host_SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC"); // By [515]
2170 Cvar_RegisterVariable (&rcon_password);
2171 Cvar_RegisterVariable (&rcon_address);
2172 Cmd_AddCommand ("rcon", Host_Rcon_f, "sends a command to the server console (if your rcon_password matches the server's rcon_password), or to the address specified by rcon_address when not connected (again rcon_password must match the server's)");
2173 Cmd_AddCommand ("packet", Host_Packet_f, "send a packet to the specified address:port containing a text string");
2175 Cvar_RegisterVariable(&sv_cheats);