]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Update sendcvar
authorSamual <samual@xonotic.org>
Fri, 30 Dec 2011 00:39:21 +0000 (19:39 -0500)
committerSamual <samual@xonotic.org>
Fri, 30 Dec 2011 00:39:21 +0000 (19:39 -0500)
qcsrc/client/command/cl_cmd.qc

index 9e4dba32d2a6c46ba62188fd81d8db14e72ec156..77cbddd85d5a644f8c77b53d5272162937f0c9ae 100644 (file)
@@ -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 <cvar>\n");