]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
new command: sv_cmd adminmsg <clientno> "string" <infobartime>
authorRudolf Polzer <divVerent@xonotic.org>
Fri, 1 Apr 2011 13:07:57 +0000 (15:07 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 1 Apr 2011 13:07:57 +0000 (15:07 +0200)
shows using the "infobar" console command on the client

qcsrc/server/gamecommand.qc

index e1d7cb15df518149d7665ef07918f80dd8ade1e9..9f29cc1375003d0dddb0974ac5ece86eb81c70c3 100644 (file)
@@ -680,7 +680,7 @@ void GameCommand(string command)
        if(argv(0) == "help" || argc == 0)
        {
                print("Usage: sv_cmd COMMAND..., where possible commands are:\n");
-               print("  adminmsg clientnumber \"message\"\n");
+               print("  adminmsg clientnumber \"message\" [infobartime]\n");
                print("  teamstatus\n");
                print("  printstats\n");
                print("  make_mapinfo\n");
@@ -761,7 +761,7 @@ void GameCommand(string command)
        }
 
        if(argv(0) == "adminmsg")
-       if(argc == 3)
+       if(argc >= 3 && argc <= 4)
        {
                entno = stof(argv(1));
 
@@ -774,8 +774,20 @@ void GameCommand(string command)
 
                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");
                }
                else