diff options
author | Haru <haru@dotalux.com> | 2015-01-23 13:50:03 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-01-24 14:37:26 +0100 |
commit | dfe8337d9ddb1a0b356ae86de9955845d280b759 (patch) | |
tree | f13976e43362237a697216a09457c1fa0ea41fae /src/map/channel.c | |
parent | 3cfc6ddac576e236ccad0497d8e2ed2ae827c2bb (diff) | |
download | hercules-dfe8337d9ddb1a0b356ae86de9955845d280b759.tar.gz hercules-dfe8337d9ddb1a0b356ae86de9955845d280b759.tar.bz2 hercules-dfe8337d9ddb1a0b356ae86de9955845d280b759.tar.xz hercules-dfe8337d9ddb1a0b356ae86de9955845d280b759.zip |
Added script command 'channelmes'
Special thanks to Dastgir
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/channel.c')
-rw-r--r-- | src/map/channel.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/map/channel.c b/src/map/channel.c index 7e0b9e15d..34ce60211 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -247,24 +247,31 @@ void channel_set_options(struct channel_data *chan, unsigned int options) * @param chan The destination channel. * @param sd The source character. * @param msg The message to send. + * + * If no source character is specified, it'll send an anonymous message. */ void channel_send(struct channel_data *chan, struct map_session_data *sd, const char *msg) { + char message[150]; nullpo_retv(chan); - nullpo_retv(sd); - if (chan->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + chan->msg_delay*1000, timer->gettick()) > 0 + if (sd && chan->msg_delay != 0 + && DIFF_TICK(sd->hchsysch_tick + chan->msg_delay*1000, timer->gettick()) > 0 && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) { clif->colormes(sd->fd,COLOR_RED,msg_txt(1455)); return; - } else { - char message[150]; + } else if (sd) { snprintf(message, 150, "[ #%s ] %s : %s",chan->name,sd->status.name, msg); clif->channel_msg(chan,sd,message); if (chan->type == HCS_TYPE_IRC) ircbot->relay(sd->status.name,msg); if (chan->msg_delay != 0) sd->hchsysch_tick = timer->gettick(); + } else { + snprintf(message, 150, "[ #%s ] %s",chan->name, msg); + clif->channel_msg2(chan, message); + if (chan->type == HCS_TYPE_IRC) + ircbot->relay(NULL, msg); } } |