From: Mattia Basaglia Date: Mon, 23 Mar 2015 18:46:18 +0000 (+0100) Subject: make ircmsg behave like say X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fd0205a3a8232dcb7a9ea09696589c6d2e055aa7;p=xonotic%2Fxonotic-data.pk3dir.git make ircmsg behave like say --- diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index f558fe59a..84e91009c 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -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); } } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index fdc0b0659..3785ef07d 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -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") \