Here's how I'd do it.
First, add another string to the com_msgs matrix:
Code:
/* com_msgs: [0] Message if you can't perform the action because of noshout
* [1] name of the action
* [2] message if you're not on the channel
- * [3] a color string. */
+ * [3] a color string.
* [4] name of the action if the noise is made by an imm. */
const char *com_msgs[][4] = {
{"You cannot holler!!\r\n",
"holler",
"",
- KYEL},
+ KYEL,
+ NULL},
{"You cannot shout!!\r\n",
"shout",
"Turn off your noshout flag first!\r\n",
- KYEL},
+ KYEL,
+ NULL},
{"You cannot gossip!!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
- KYEL},
+ KYEL,
+ "immgossip"},
{"You cannot auction!!\r\n",
"auction",
"You aren't even on the channel!\r\n",
- KMAG},
+ KMAG,
+ NULL},
{"You cannot congratulate!\r\n",
"congrat",
"You aren't even on the channel!\r\n",
- KGRN},
+ KGRN,
+ NULL},
{"You cannot gossip your emotions!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
- KYEL}
+ KYEL,
+ NULL}
};
And then below, add another check:
Code:
- snprintf(buf1, sizeof(buf1), "%sYou %s, '%s%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "",
- com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP));
+ snprintf(buf1, sizeof(buf1), "%sYou %s, '%s%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "",
+ (com_msgs[subcmd][4] != NULL && !IS_NPC(ch) && GET_LEVEL(ch) >= LVL_IMMORT) ? com_msgs[subcmd][4] : com_msgs[subcmd][1],
+ argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP));
And similarly a little further down:
Code:
- snprintf(buf1, sizeof(buf1), "$n %ss, '%s'", com_msgs[subcmd][1], argument);
+ snprintf(buf1, sizeof(buf1), "$n %ss, '%s'",
+ (com_msgs[subcmd][4] != NULL && !IS_NPC(ch) && GET_LEVEL(ch) >= LVL_IMMORT) ? com_msgs[subcmd][4] : com_msgs[subcmd][1],
+ argument);
I hope you see what I'm going for here?