/* cl_cmd.c client command forwarding to server $Header: /cvsroot/uhexen2/hexenworld/Client/cl_cmd.c,v 1.5 2007/02/25 19:01:15 sezero Exp $ */ #include "quakedef.h" /* =================== Cmd_ForwardToServer adds the current command line as a clc_stringcmd to the client message. things like godmode, noclip, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded. =================== */ void Cmd_ForwardToServer (void) { if (cls.state == ca_disconnected) { Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0)); return; } if (cls.demoplayback) return; // not really connected MSG_WriteByte (&cls.netchan.message, clc_stringcmd); SZ_Print (&cls.netchan.message, Cmd_Argv(0)); if (Cmd_Argc() > 1) { SZ_Print (&cls.netchan.message, " "); SZ_Print (&cls.netchan.message, Cmd_Args()); } } // This is the command variant of the above. The only difference // is that it doesn't forward the first argument, which is "cmd" void Cmd_ForwardToServer_f (void) { if (cls.state == ca_disconnected) { Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0)); return; } if (cls.demoplayback) return; // not really connected if (Cmd_Argc() > 1) { MSG_WriteByte (&cls.netchan.message, clc_stringcmd); SZ_Print (&cls.netchan.message, Cmd_Args()); } } void CL_Cmd_Init (void) { Cmd_AddCommand ("cmd", Cmd_ForwardToServer_f); }