]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
make ircmsg behave like say
authorMattia Basaglia <mattia.basaglia@gmail.com>
Mon, 23 Mar 2015 18:46:18 +0000 (19:46 +0100)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Mon, 23 Mar 2015 18:46:18 +0000 (19:46 +0100)
qcsrc/server/cl_player.qc
qcsrc/server/command/sv_cmd.qc

index f558fe59afe09ac7a0349c4371f783145ceabf50..84e91009ccde99962f6af3bc0393501bc20108f1 100644 (file)
@@ -937,34 +937,22 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
        return ret;
 }
 
-void IRCSay(string sourcename, string msgin)
+void IRCSay(string msgstr)
 {
-       entity head;
-
-       if(substring(msgin, 0, 1) == " ")
-               msgin = substring(msgin, 1, strlen(msgin) - 1); // work around DP say bug (say_team does not have this!)
-
-       //msgin = formatmessage(msgin);
-
-       if(msgin == "")
+       if(msgstr == "")
                return;
 
-    string msgstr = strcat("\{1}[IRC] ", sourcename, "^7", msgin);
+       msgstr = strcat("\{1}", strreplace("\n", " ", msgstr), "\n"); // newlines only are good for centerprint
 
-       msgstr = strcat(strreplace("\n", " ", msgstr), "\n"); // newlines only are good for centerprint
-
-       FOR_EACH_CLIENTSLOT(head)
+       entity head;
+       FOR_EACH_REALCLIENT(head)
        {
                if(!intermission_running)
                if((autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(warmup_stage || gameover)))
                if(IS_PLAYER(head))
                        continue;
-
-               //if(head.netaddress)
-               //if(head.netaddress != "")
-               //if(head.netaddress != "null/botclient")
-               if(IS_REAL_CLIENT(head))
-                       sprint(head, msgstr);
+               
+               sprint(head, msgstr);
        }
 }
 
index fdc0b065946ac5b02db9365f0d7d5d890e4bfd44..3785ef07d228cb0abbb901b6e437765d01aa7208 100644 (file)
@@ -1001,13 +1001,13 @@ void GameCommand_gravity(float request, float argc)
        }
 }
 
-void GameCommand_ircmsg(float request, float argc)
+void GameCommand_ircmsg(float request, float argc, string command)
 {
        switch(request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       IRCSay(argv(1), argv(2));
+                       IRCSay(substring(command, strlen(argv(0))+1, strlen(command)));
                        return;
                }
                        
@@ -1958,7 +1958,7 @@ void GameCommand_(float request)
        SERVER_COMMAND("gettaginfo", GameCommand_gettaginfo(request, arguments), "Get specific information about a weapon model") \
        SERVER_COMMAND("gotomap", GameCommand_gotomap(request, arguments), "Simple command to switch to another map") \
        SERVER_COMMAND("gravity", GameCommand_gravity(request, arguments), "Changes gravity based on cvars") \
-       SERVER_COMMAND("ircmsg", GameCommand_ircmsg(request, arguments), "Say a message as an IRC user") \
+       SERVER_COMMAND("ircmsg", GameCommand_ircmsg(request, arguments, command), "Say a message as an IRC user") \
        SERVER_COMMAND("lockteams", GameCommand_lockteams(request), "Disable the ability for players to switch or enter teams") \
        SERVER_COMMAND("make_mapinfo", GameCommand_make_mapinfo(request), "Automatically rebuild mapinfo files") \
        SERVER_COMMAND("moveplayer", GameCommand_moveplayer(request, arguments), "Change the team/status of a player") \