From: Samual Date: Fri, 30 Dec 2011 00:39:21 +0000 (-0500) Subject: Update sendcvar X-Git-Tag: xonotic-v0.6.0~188^2~28^2~24 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b87c052a7c6717dbac33a8d848e74ebfc3ec9bdb;p=xonotic%2Fxonotic-data.pk3dir.git Update sendcvar --- diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index 9e4dba32d..77cbddd85 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -250,21 +250,25 @@ void LocalCommand_sendcvar(float request, float argc) { case CMD_REQUEST_COMMAND: { - // W_FixWeaponOrder will trash argv, so save what we need. - string thiscvar = strzone(argv(1)); - string s = cvar_string(thiscvar); - - if(thiscvar == "cl_weaponpriority") - s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 1); - else if(substring(thiscvar, 0, 17) == "cl_weaponpriority" && strlen(thiscvar) == 18) - s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 0); + if(argv(1)) + { + // W_FixWeaponOrder will trash argv, so save what we need. + string thiscvar = strzone(argv(1)); + string s = cvar_string(thiscvar); - localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n"); - strunzone(thiscvar); - return; + if(thiscvar == "cl_weaponpriority") + s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 1); + else if(substring(thiscvar, 0, 17) == "cl_weaponpriority" && strlen(thiscvar) == 18) + s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 0); + + localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n"); + strunzone(thiscvar); + return; + } } default: + print("Incorrect parameters for ^2sendcvar^7\n"); case CMD_REQUEST_USAGE: { print("\nUsage:^3 cl_cmd sendcvar \n");