Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] The Source Code → how to make info channel ?

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 5

1

Topic: how to make info channel ?

i want to ask you how to make info channel ?

so, if i type: /x hello
it will show:
Info Channel From Jimmy_Aquarius: Hello
it will show to all user in the channel

this is my code

static int _handle_infochannel_command(t_connection * c, char const * text)
{

snprintf(msgtemp, sizeof(msgtemp), "Info Channel from %.64s: %.128s",conn_get_username(c),&text[i]);
channel_message_send(channel,message_type_error,c,msgtemp);

return 0;
}

please correct it

Thanks

2

Re: how to make info channel ?

See implementation of function channel_message_send. There are only message_type_talk and message_type_emote types are handled to send to all users in channel. So you can use it like in _handle_me_command function. All users will see who use command /x:

static int _handle_infochannel_command(t_connection * c, char const * text)
{
  t_channel const * channel;

  if (!(channel = conn_get_channel(c)))
    {
      message_send_text(c,message_type_error,c,"You are not in a channel.");
      return 0;
    }

snprintf(msgtemp, sizeof(msgtemp), "Info Channel from %.64s: %.128s",conn_get_username(c),&text[i]);
channel_message_send(channel,message_type_emote,c,msgtemp);

return 0;
}

Or you can iterate all users connections, check current channel of each and do something you want:

LIST_TRAVERSE_CONST(connlist(),curr)
    {
    c = (t_connection*)elem_get_data(curr);
    // your code
    }
Do not ask for support in PM.

3 (edited by Jimmy_Aquarius 02.02.2013 05:32)

Re: how to make info channel ?

HarpyWar wrote:
static int _handle_infochannel_command(t_connection * c, char const * text)
{
  t_channel const * channel;

  if (!(channel = conn_get_channel(c)))
    {
      message_send_text(c,message_type_error,c,"You are not in a channel.");
      return 0;
    }

snprintf(msgtemp, sizeof(msgtemp), "Info Channel from %.64s: %.128s",conn_get_username(c),&text[i]);
channel_message_send(channel,message_type_emote,c,msgtemp);

return 0;
}

when i use it
it says:
1>..\..\..\src\bnetd\command.cpp(849) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
1>..\..\..\src\bnetd\command.cpp(2611) : error C2065: 'i' : undeclared identifier

what's wrong ?

4

Re: how to make info channel ?

Read the error message - 'i' is undeclared identifier.
I don't know why did you use &text{i} (mindless copy-paste?), look at the function _handle_me_command in command.cpp and do the same.

Do not ask for support in PM.

5

Re: how to make info channel ?

ok thx sir
i got it

big_smile

Posts: 5

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 1 guest, 0 registered users

forums.pvpgn.pro → [EN] The Source Code → how to make info channel ?