int current_skill;
cvar_t sv_cheats = {0, "sv_cheats", "0", "enables cheat commands in any game, and cheat impulses in dpmod"};
+cvar_t rcon_password = {0, "rcon_password", "", "password to authenticate rcon commands"};
+cvar_t rcon_address = {0, "rcon_address", "", "server address to send rcon commands to (when not connected to a server)"};
qboolean allowcheats = false;
/*
host_client->nametime = sv.time + 5;
// point the string back at updateclient->name to keep it safe
+ SV_VM_Begin();
strlcpy (host_client->name, newName, sizeof (host_client->name));
host_client->edict->fields.server->netname = PRVM_SetEngineString(host_client->name);
if (strcmp(host_client->old_name, host_client->name))
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteString (&sv.reliable_datagram, host_client->name);
}
+ SV_VM_End();
}
/*
host_client->nametime = sv.time + 5;
*/
+ SV_VM_Begin();
// point the string back at updateclient->name to keep it safe
strlcpy (host_client->playermodel, newPath, sizeof (host_client->playermodel));
if( eval_playermodel )
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteString (&sv.reliable_datagram, host_client->playermodel);*/
}
+ SV_VM_End();
}
/*
host_client->nametime = sv.time + 5;
*/
+ SV_VM_Begin();
// point the string back at updateclient->name to keep it safe
strlcpy (host_client->playerskin, newPath, sizeof (host_client->playerskin));
if( eval_playerskin )
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteString (&sv.reliable_datagram, host_client->playerskin);*/
}
+ SV_VM_End();
}
void Host_Version_f (void)
return;
}
+ SV_VM_Begin();
if (host_client->edict && (f = PRVM_ED_FindFunction ("SV_ChangeTeam")) && (SV_ChangeTeam = (func_t)(f - prog->functions)))
{
Con_DPrint("Calling SV_ChangeTeam\n");
MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
}
}
+ SV_VM_End();
}
cvar_t cl_rate = {CVAR_SAVE, "_cl_rate", "10000", "internal storage cvar for current rate (changed by rate command)"};
return;
}
+ SV_VM_Begin();
prog->globals.server->time = sv.time;
prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
PRVM_ExecuteProgram (prog->globals.server->ClientKill, "QC function ClientKill is missing");
+ SV_VM_End();
}
return;
}
+ SV_VM_Begin();
if (host_client->edict && (val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_pmodel)))
val->_float = i;
+ SV_VM_End();
}
//===========================================================================
// SZ_Clear (&host_client->netconnection->message);
// run the entrance script
+ SV_VM_Begin();
if (sv.loadgame)
{
// loaded games are fully initialized already
PRVM_ExecuteProgram (prog->globals.server->PutClientInServer, "QC function PutClientInServer is missing");
}
+ SV_VM_End();
if (!host_client->netconnection)
return;
+ SV_VM_Begin();
// send time of update
MSG_WriteByte (&host_client->netconnection->message, svc_time);
MSG_WriteFloat (&host_client->netconnection->message, sv.time);
MSG_WriteByte (&host_client->netconnection->message, svc_signonnum);
MSG_WriteByte (&host_client->netconnection->message, 3);
+ SV_VM_End();
}
/*
t = Cmd_Argv(1);
v = atoi (Cmd_Argv(2));
+ SV_VM_Begin();
switch (t[0])
{
case '0':
}
break;
}
+ SV_VM_End();
}
prvm_edict_t *FindViewthing (void)
//=============================================================================
+// QuakeWorld commands
+
+char emodel_name[] =
+ { 'e' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff, 0 };
+char pmodel_name[] =
+ { 'p' ^ 0xff, 'm' ^ 0xff, 'o' ^ 0xff, 'd' ^ 0xff, 'e' ^ 0xff, 'l' ^ 0xff, 0 };
+char prespawn_name[] =
+ { 'p'^0xff, 'r'^0xff, 'e'^0xff, 's'^0xff, 'p'^0xff, 'a'^0xff, 'w'^0xff, 'n'^0xff,
+ ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '0'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
+char modellist_name[] =
+ { 'm'^0xff, 'o'^0xff, 'd'^0xff, 'e'^0xff, 'l'^0xff, 'l'^0xff, 'i'^0xff, 's'^0xff, 't'^0xff,
+ ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
+char soundlist_name[] =
+ { 's'^0xff, 'o'^0xff, 'u'^0xff, 'n'^0xff, 'd'^0xff, 'l'^0xff, 'i'^0xff, 's'^0xff, 't'^0xff,
+ ' '^0xff, '%'^0xff, 'i'^0xff, ' '^0xff, '%'^0xff, 'i'^0xff, 0 };
+
+/*
+=====================
+Host_Rcon_f
+
+ Send the rest of the command line over as
+ an unconnected command.
+=====================
+*/
+void Host_Rcon_f (void) // credit: taken from QuakeWorld
+{
+ lhnetaddress_t to;
+ lhnetsocket_t *mysocket;
+
+ if (!rcon_password.string)
+ {
+ Con_Printf ("You must set rcon_password before issuing an rcon command.\n");
+ return;
+ }
+
+ if (cls.netcon)
+ to = cls.netcon->peeraddress;
+ else
+ {
+ if (!rcon_address.integer || !rcon_address.string[0])
+ {
+ Con_Printf ("You must either be connected, or set the rcon_address cvar to issue rcon commands\n");
+ return;
+ }
+ LHNETADDRESS_FromString(&to, rcon_address.string, sv_netport.integer);
+ }
+ mysocket = NetConn_ChooseClientSocketForAddress(&to);
+ if (mysocket)
+ {
+ // simply put together the rcon packet and send it
+ NetConn_WriteString(mysocket, va("\377\377\377\377rcon %s %s", rcon_password.string, Cmd_Args()), &to);
+ }
+}
+
+/*
+====================
+Host_Packet_f
+
+packet <destination> <contents>
+
+Contents allows \n escape character
+====================
+*/
+void Host_Packet_f (void) // credit: taken from QuakeWorld
+{
+ char send[2048];
+ int i, l;
+ const char *in;
+ char *out;
+ lhnetaddress_t address;
+ lhnetsocket_t *mysocket;
+
+ if (Cmd_Argc() != 3)
+ {
+ Con_Printf ("packet <destination> <contents>\n");
+ return;
+ }
+
+ if (!LHNETADDRESS_FromString (&address, Cmd_Argv(1), sv_netport.integer))
+ {
+ Con_Printf ("Bad address\n");
+ return;
+ }
+
+ in = Cmd_Argv(2);
+ out = send+4;
+ send[0] = send[1] = send[2] = send[3] = 0xff;
+
+ l = strlen (in);
+ for (i=0 ; i<l ; i++)
+ {
+ if (out >= send + sizeof(send) - 1)
+ break;
+ if (in[i] == '\\' && in[i+1] == 'n')
+ {
+ *out++ = '\n';
+ i++;
+ }
+ else
+ *out++ = in[i];
+ }
+ *out = 0;
+
+ mysocket = NetConn_ChooseClientSocketForAddress(&address);
+ if (mysocket)
+ NetConn_WriteString(mysocket, send, &address);
+}
+
+//=============================================================================
+
/*
==================
Host_InitCommands
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]
+ Cvar_RegisterVariable (&rcon_password);
+ Cvar_RegisterVariable (&rcon_address);
+ 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)");
+ Cmd_AddCommand ("packet", Host_Packet_f, "send a packet to the specified address:port containing a text string");
+
Cvar_RegisterVariable(&sv_cheats);
}