#include <time.h>
int current_skill;
-cvar_t sv_cheats = {CVAR_SERVER, "sv_cheats", "0", "enables cheat commands in any game, and cheat impulses in dpmod"};
+cvar_t sv_cheats = {CVAR_SERVER | CVAR_NOTIFY, "sv_cheats", "0", "enables cheat commands in any game, and cheat impulses in dpmod"};
cvar_t sv_adminnick = {CVAR_SERVER | CVAR_SAVE, "sv_adminnick", "", "nick name to use for admin messages instead of host name"};
cvar_t sv_status_privacy = {CVAR_SERVER | CVAR_SAVE, "sv_status_privacy", "0", "do not show IP addresses in 'status' replies to clients"};
cvar_t sv_status_show_qcstatus = {CVAR_SERVER | CVAR_SAVE, "sv_status_show_qcstatus", "0", "show the 'qcstatus' field in status replies, not the 'frags' field. Turn this on if your mod uses this field, and the 'frags' field on the other hand has no meaningful value."};
cvar_t skin = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "skin", "", "QW player skin name (example: base)"};
cvar_t noaim = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "noaim", "1", "QW option to disable vertical autoaim"};
cvar_t r_fixtrans_auto = {CVAR_CLIENT, "r_fixtrans_auto", "0", "automatically fixtrans textures (when set to 2, it also saves the fixed versions to a fixtrans directory)"};
-qboolean allowcheats = false;
extern qboolean host_shuttingdown;
extern cvar_t developer_entityparsing;
if(sv_status_privacy.integer && cmd->source != src_command)
strlcpy(ip, client->netconnection ? "hidden" : "botclient", 48);
else
- strlcpy(ip, (client->netconnection && client->netconnection->address) ? client->netconnection->address : "botclient", 48);
+ strlcpy(ip, (client->netconnection && *client->netconnection->address) ? client->netconnection->address : "botclient", 48);
frags = client->frags;
static void Host_God_f(cmd_state_t *cmd)
{
prvm_prog_t *prog = SVVM_prog;
- if (!allowcheats)
+ if (!sv_cheats.integer)
{
- SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
+ SV_ClientPrint("No cheats allowed. Set sv_cheats to 1 in the server console to enable.\n");
return;
}
static void Host_Notarget_f(cmd_state_t *cmd)
{
prvm_prog_t *prog = SVVM_prog;
- if (!allowcheats)
+ if (!sv_cheats.integer)
{
- SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
+ SV_ClientPrint("No cheats allowed. Set sv_cheats to 1 in the server console to enable.\n");
return;
}
static void Host_Noclip_f(cmd_state_t *cmd)
{
prvm_prog_t *prog = SVVM_prog;
- if (!allowcheats)
+ if (!sv_cheats.integer)
{
- SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
+ SV_ClientPrint("No cheats allowed. Set sv_cheats to 1 in the server console to enable.\n");
return;
}
static void Host_Fly_f(cmd_state_t *cmd)
{
prvm_prog_t *prog = SVVM_prog;
- if (!allowcheats)
+ if (!sv_cheats.integer)
{
- SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
+ SV_ClientPrint("No cheats allowed. Set sv_cheats to 1 in the server console to enable.\n");
return;
}
}
}
+// Disable cheats if sv_cheats is turned off
+static void Host_DisableCheats_c(char *value)
+{
+ prvm_prog_t *prog = SVVM_prog;
+ int i = 0;
+
+ if (value[0] == '0' && !value[1])
+ {
+ while (svs.clients[i].edict)
+ {
+ if (((int)PRVM_serveredictfloat(svs.clients[i].edict, flags) & FL_GODMODE))
+ PRVM_serveredictfloat(svs.clients[i].edict, flags) = (int)PRVM_serveredictfloat(svs.clients[i].edict, flags) ^ FL_GODMODE;
+ if (((int)PRVM_serveredictfloat(svs.clients[i].edict, flags) & FL_NOTARGET))
+ PRVM_serveredictfloat(svs.clients[i].edict, flags) = (int)PRVM_serveredictfloat(svs.clients[i].edict, flags) ^ FL_NOTARGET;
+ if (PRVM_serveredictfloat(svs.clients[i].edict, movetype) == MOVETYPE_NOCLIP ||
+ PRVM_serveredictfloat(svs.clients[i].edict, movetype) == MOVETYPE_FLY)
+ {
+ noclip_anglehack = false;
+ PRVM_serveredictfloat(svs.clients[i].edict, movetype) = MOVETYPE_WALK;
+ }
+ i++;
+ }
+ }
+}
+
/*
===============================================================================
key_dest = key_game;
svs.serverflags = 0; // haven't completed an episode yet
- allowcheats = sv_cheats.integer != 0;
strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
SV_SpawnServer(level);
if (sv.active && cls.state == ca_disconnected)
key_dest = key_game;
SV_SaveSpawnparms ();
- allowcheats = sv_cheats.integer != 0;
strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
SV_SpawnServer(level);
if (sv.active && cls.state == ca_disconnected)
#endif
key_dest = key_game;
- allowcheats = sv_cheats.integer != 0;
strlcpy(mapname, sv.name, sizeof(mapname));
SV_SpawnServer(mapname);
if (sv.active && cls.state == ca_disconnected)
S_StopAllSounds();
- if (cls.state == ca_connected && cls.signon < SIGNONS)
+ if (cls.state == ca_connected)
{
- Con_Printf("reconnecting...\n");
+ Con_Printf("Server is changing level...\n");
MSG_WriteChar(&cls.netcon->message, qw_clc_stringcmd);
MSG_WriteString(&cls.netcon->message, "new");
}
}
}
else
- Con_Print("Warning: saving a multiplayer game may have strange results when restored (to properly resume, all players must join in the same player slots and then the game can be reloaded).\n");
+ Con_Warn("Warning: saving a multiplayer game may have strange results when restored (to properly resume, all players must join in the same player slots and then the game can be reloaded).\n");
if (Cmd_Argc(cmd) != 2)
{
COM_ParseToken_Simple(&t, false, false, true);
time = atof(com_token);
- allowcheats = sv_cheats.integer != 0;
-
if(developer_entityparsing.integer)
Con_Printf("Host_Loadgame_f: spawning server\n");
PRVM_ED_ParseEdict (prog, start, ent);
// link it into the bsp tree
- if (!ent->priv.server->free)
+ if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
SV_LinkEdict(ent);
}
if (COM_ParseToken_Simple(&t, false, false, true))
k |= atoi(com_token);
if (!BufStr_FindCreateReplace(prog, i, k, "string"))
- Con_Printf("failed to create stringbuffer %i\n", i);
+ Con_Errorf("failed to create stringbuffer %i\n", i);
}
else
Con_Printf("unsupported stringbuffer index %i \"%s\"\n", i, com_token);
Con_Printf("unexpected end of line when parsing sv.bufstr (expected strindex)\n");
}
else
- Con_Printf("failed to create stringbuffer %i \"%s\"\n", i, com_token);
+ Con_Errorf("failed to create stringbuffer %i \"%s\"\n", i, com_token);
}
}
// skip any trailing text or unrecognized commands
const char *t;
int v;
- if (!allowcheats)
+ if (!sv_cheats.integer)
{
SV_ClientPrint("No cheats allowed, use sv_cheats 1 and restart level to enable.\n");
return;
Send back ping and packet loss update for all current players to this player
====================
*/
-void Host_Pings_f(cmd_state_t *cmd)
+static void Host_Pings_f(cmd_state_t *cmd)
{
int i, j, ping, packetloss, movementloss;
char temp[128];
Cvar_RegisterVariable(&skin);
Cvar_RegisterVariable(&noaim);
Cvar_RegisterVariable(&sv_cheats);
+ Cvar_RegisterCallback(&sv_cheats, Host_DisableCheats_c);
Cvar_RegisterVariable(&sv_adminnick);
Cvar_RegisterVariable(&sv_status_privacy);
Cvar_RegisterVariable(&sv_status_show_qcstatus);
Cmd_AddCommand(&cmd_serverfromclient, "playerskin", Host_Playerskin_f, "change your player skin number");
// client commands that require a connection and are simply forwarded to server
- Cmd_AddCommand(&cmd_client, "status", Cmd_ForwardToServer_f, "print server status information");
Cmd_AddCommand(&cmd_client, "god", Cmd_ForwardToServer_f, "god mode (invulnerability)");
Cmd_AddCommand(&cmd_client, "notarget", Cmd_ForwardToServer_f, "notarget mode (monsters do not see you)");
Cmd_AddCommand(&cmd_client, "fly", Cmd_ForwardToServer_f, "fly mode (flight)");
Cmd_AddCommand(&cmd_client, "noclip", Cmd_ForwardToServer_f, "noclip mode (flight without collisions, move through walls)");
Cmd_AddCommand(&cmd_client, "give", Cmd_ForwardToServer_f, "alter inventory");
- Cmd_AddCommand(&cmd_client, "say", Cmd_ForwardToServer_f, "send a chat message to everyone on the server");
Cmd_AddCommand(&cmd_client, "say_team", Cmd_ForwardToServer_f, "send a chat message to your team on the server");
- Cmd_AddCommand(&cmd_client, "tell", Cmd_ForwardToServer_f, "send a chat message to only one person on the server");
Cmd_AddCommand(&cmd_client, "kill", Cmd_ForwardToServer_f, "die instantly");
- Cmd_AddCommand(&cmd_client, "pause", Cmd_ForwardToServer_f, "pause the game (if the server allows pausing)");
- Cmd_AddCommand(&cmd_client, "ping", Cmd_ForwardToServer_f, "print ping times of all players on the server");
Cmd_AddCommand(&cmd_client, "connect", Host_Connect_f, "connect to a server by IP address or hostname");
Cmd_AddCommand(&cmd_client, "reconnect", Host_Reconnect_f, "reconnect to the last server you were on, or resets a quakeworld connection (do not use if currently playing on a netquake server)");
- Cmd_AddCommand(&cmd_client, "version", Host_Version_f, "print engine version");
+ Cmd_AddCommand(&cmd_clientfromserver, "reconnect", Host_Reconnect_f, "reconnect to the last server you were on, or resets a quakeworld connection (do not use if currently playing on a netquake server)");
Cmd_AddCommand(&cmd_client, "startdemos", Host_Startdemos_f, "start playing back the selected demos sequentially (used at end of startup script)");
Cmd_AddCommand(&cmd_client, "demos", Host_Demos_f, "restart looping demos defined by the last startdemos command");
Cmd_AddCommand(&cmd_client, "stopdemo", Host_Stopdemo_f, "stop playing or recording demo (like stop command) and return to looping demos");
Cmd_AddCommand(&cmd_client, "fullinfo", Host_FullInfo_f, "allows client to modify their userinfo");
Cmd_AddCommand(&cmd_client, "setinfo", Host_SetInfo_f, "modifies your userinfo");
Cmd_AddCommand(&cmd_client, "packet", Host_Packet_f, "send a packet to the specified address:port containing a text string");
+ Cmd_AddCommand(&cmd_clientfromserver, "packet", Host_Packet_f, "send a packet to the specified address:port containing a text string");
Cmd_AddCommand(&cmd_client, "topcolor", Host_TopColor_f, "QW command to set top color without changing bottom color");
+ Cmd_AddCommand(&cmd_clientfromserver, "topcolor", Host_TopColor_f, "QW command to set top color without changing bottom color");
Cmd_AddCommand(&cmd_client, "bottomcolor", Host_BottomColor_f, "QW command to set bottom color without changing top color");
Cmd_AddCommand(&cmd_client, "fixtrans", Image_FixTransparentPixels_f, "change alpha-zero pixels in an image file to sensible values, and write out a new TGA (warning: SLOW)");