]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
in adminmsg: entnumber 0 means "all clients"
authorRudolf Polzer <divVerent@xonotic.org>
Fri, 1 Apr 2011 13:12:55 +0000 (15:12 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 1 Apr 2011 13:12:55 +0000 (15:12 +0200)
qcsrc/server/gamecommand.qc

index 9f29cc1375003d0dddb0974ac5ece86eb81c70c3..b0085224fadb3064e9aef6a817c1c2a6fc263222 100644 (file)
@@ -765,32 +765,36 @@ void GameCommand(string command)
        {
                entno = stof(argv(1));
 
-               if((entno < 1) | (entno > maxclients)) {
+               if((entno < 0) | (entno > maxclients)) {
                        print("Player ", argv(1), " doesn't exist\n");
                        return;
                }
 
-               client = edict_num(entno);
-
-               if(client.flags & FL_CLIENT)
+               n = 0;
+               for(i = (entno ? entno : 1); i <= (entno ? entno : maxclients); ++i)
                {
-                       if(argc == 4)
-                       {
-                               s = argv(2);
-                               s = strreplace(s, "\n", "");
-                               s = strreplace(s, "\\", "\\\\");
-                               s = strreplace(s, "$", "$$");
-                               s = strreplace(s, "\"", "\\\"");
-                               stuffcmd(client, sprintf("\ninfobar %f \"%s\"\n", stof(argv(3)), s));
-                       }
-                       else
+                       client = edict_num(i);
+                       if(client.flags & FL_CLIENT)
                        {
-                               centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3", admin_name(), ":\n\n^7", argv(2)));
-                               sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", argv(2), "\n"));
+                               if(argc == 4)
+                               {
+                                       s = argv(2);
+                                       s = strreplace(s, "\n", "");
+                                       s = strreplace(s, "\\", "\\\\");
+                                       s = strreplace(s, "$", "$$");
+                                       s = strreplace(s, "\"", "\\\"");
+                                       stuffcmd(client, sprintf("\ninfobar %f \"%s\"\n", stof(argv(3)), s));
+                               }
+                               else
+                               {
+                                       centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3", admin_name(), ":\n\n^7", argv(2)));
+                                       sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", argv(2), "\n"));
+                               }
+                               print("Message sent to ", client.netname, "\n");
+                               ++n;
                        }
-                       print("Message sent to ", client.netname, "\n");
                }
-               else
+               if(!n)
                        print("Client not found\n");
 
                return;