01 Oct, 2011, triskaledia wrote in the 1st comment:
Votes: 0
/* clan channels  do_chant */
void do_clantalk (CHAR_DATA * ch, char *argument)
{
char buf[MAX_STRING_LENGTH];
DESCRIPTOR_DATA *d;

if (argument[0] == '\0')
{
if (IS_SET (ch->comm, COMM_NOCLAN))
{
send_to_char ("Chant channel is now ON\n\r", ch);
REMOVE_BIT (ch->comm, COMM_NOCLAN);
}
else
{
send_to_char ("Chant channel is now OFF\n\r", ch);
SET_BIT (ch->comm, COMM_NOCLAN);
}
return;
}
if (IS_SET (ch->comm, COMM_NOCHANNELS))
{
send_to_char ("The gods have revoked your channel priviliges.\n\r", ch);
return;
}

if(IS_AFFECTED2(ch, AFF2_SILENCE))
{
stc("You go to say what you think, but your lips don't make a sound.\n\r", ch);
return;
}

REMOVE_BIT (ch->comm, COMM_NOCLAN);

sprintf( buf, "{b%s %s{w: %s\n\r", player_rank(ch), ch->name, argument );
send_to_char (buf, ch);

for ( d = descriptor_list; d != NULL; d = d->next )
{
CHAR_DATA *victim;
victim = d->original ? d->original : d->character;

if ( d->connected == CON_PLAYING &&
is_same_clan(victim, d->character) &&
!IS_SET(victim->comm,COMM_NOCLAN) &&
!IS_SET(victim->comm,COMM_QUIET))
{
sprintf( buf, "{b%s %s{w: %s\n\r", player_rank(ch), ch->name, argument );
stc(buf, victim);
}
return;
}
}


Trying to get it so that only members of the same clan can see the message sent.
Been playing around with it for a while and tried mixing variables up and such, this is the closest I've got - for it at least shows the original player the message. Any help getting this to work is appreciated.
01 Oct, 2011, Zeno wrote in the 2nd comment:
Votes: 0
Uh, well are you getting errors or..?
01 Oct, 2011, Sharmair wrote in the 3rd comment:
Votes: 0
You might want to change your is_same_clan call to actualy use the
ch (the talker), instead of checking if someone is in the same clan
as themselves or who they are switched into.

Also, as you have it here, there is no reason to sprintf the output
again for everyone, as nothing changes the way you have it. You
probably should disallow sending the output a 2nd time to the
talker in the loop as you had sent to them before you entered the
loop. Or just remove that send before the loop (as that send is
also the same as all the rest) and have all the output in the loop.
01 Oct, 2011, triskaledia wrote in the 4th comment:
Votes: 0
The error is it prints out for the person trying to talk, but doesn't send it to the other people within the guild.
I'm not quite sure what you mean, Sharamair with changing the is_same_clan, I want to only print to the
people within the same guild as the ch.
01 Oct, 2011, triskaledia wrote in the 5th comment:
Votes: 0
Got it to work. After rereading why you typed, Sharamair, I realized what you were referring to. Final loop to print:
for ( d = descriptor_list; d != NULL; d = d->next )
{
CHAR_DATA *victim;
victim = d->original ? d->original : d->character;
if ( d->connected == CON_PLAYING &&
is_same_clan(victim, ch) &&
!IS_SET(victim->comm,COMM_NOCLAN) &&
!IS_SET(victim->comm,COMM_QUIET))
{
sprintf( buf, "{b%s %s{w: %s\n\r", player_rank(ch), ch->name, argument );
stc(buf, victim);
}
}
return;

I also had my return in the wrong place, and was only printing out to the first available player found.
0.0/5