Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] The Source Code → [Guide] new command to see operators who are connected online

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 4

1

Topic: [Guide] new command to see operators who are connected online

I leave this command, new to some, I hope it helps someone and greetings

Add in command.cpp

static int _handle_ops_command(t_connection * c, char const * text);

add after

{ "/ops"                , _handle_ops_command },

add after

/* VER OPERADORES */
static int _handle_ops_command(t_connection * c, char const *text)
{
  unsigned int    i;
  t_elem const *  curr;
  t_connection *  tc;
  char const *    nick;

  std::strcpy(msgtemp,"Operadores actualmente conectados:");
  i = std::strlen(msgtemp);
  LIST_TRAVERSE_CONST(connlist(),curr)
    {
      tc = (t_connection*)elem_get_data(curr);
      if (!tc)
    continue;
      if (!conn_get_account(tc))
        continue;
      if (account_get_auth_operator(conn_get_account(tc),NULL)==1)
    {
      if ((nick = conn_get_username(tc)))
        {
          if (i+std::strlen(nick)+2>sizeof(msgtemp)) /* " ", name, '\0' */
        {
          message_send_text(c,message_type_info,c,msgtemp);
          i = 0;
        }
          std::sprintf(&msgtemp[i]," %s", nick);
          i += std::strlen(&msgtemp[i]);
        }
    }
    }
  if (i>0)
    message_send_text(c,message_type_info,c,msgtemp);

  return 0;
}

2 (edited by Zeloit 12.05.2013 05:55)

Re: [Guide] new command to see operators who are connected online

my code in command "/online"   (see all crew online)

static int _handle_onlinecrew_command(t_connection * c, char const * text);
{ "/online"             , _handle_onlinecrew_command },
static int _handle_onlinecrew_command(t_connection * c, char const *text)
{
  unsigned int    i;
  t_elem const *  curr;
  t_connection *  tc;
  char const *    nick;

  /*Edited by Somad Sikimat 2/3/2012*/
  std::strcpy(msgtemp,"Currently Online Crew:");
  i = std::strlen(msgtemp);
  LIST_TRAVERSE_CONST(connlist(),curr)
    {
      tc = (t_connection*)elem_get_data(curr);
      if (!tc)
    continue;
      if (!conn_get_account(tc))
        continue;
      if ((account_get_auth_master(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_developer(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_headadmin(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_admin(conn_get_account(tc),NULL)==1) || 
          (account_get_auth_supervisor(conn_get_account(tc),NULL)==1)  ||
          (account_get_auth_headoperator(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_operator(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_voiceoperator(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_cheatanalyzer(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_teamevent(conn_get_account(tc),NULL)==1))
    {
      if ((nick = conn_get_username(tc)))
        {
          if (i+std::strlen(nick)+2>sizeof(msgtemp)) /* " ", name, '\0' */
        {
          message_send_text(c,message_type_whisper,c,msgtemp);
          i = 0;
        }
        
          std::sprintf(&msgtemp[i]," %s",nick);
          i += std::strlen(&msgtemp[i]);
        }
    }
    }
  if (i>0)
    message_send_text(c,message_type_whisper,c,msgtemp);

  return 0;
}

3

Re: [Guide] new command to see operators who are connected online

Zeloit wrote:

my code in command "/online"   (see all crew online)

static int _handle_onlinecrew_command(t_connection * c, char const * text);
{ "/online"             , _handle_onlinecrew_command },
static int _handle_onlinecrew_command(t_connection * c, char const *text)
{
  unsigned int    i;
  t_elem const *  curr;
  t_connection *  tc;
  char const *    nick;

  /*Edited by Somad Sikimat 2/3/2012*/
  std::strcpy(msgtemp,"Currently Online Crew:");
  i = std::strlen(msgtemp);
  LIST_TRAVERSE_CONST(connlist(),curr)
    {
      tc = (t_connection*)elem_get_data(curr);
      if (!tc)
    continue;
      if (!conn_get_account(tc))
        continue;
      if ((account_get_auth_master(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_developer(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_headadmin(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_admin(conn_get_account(tc),NULL)==1) || 
          (account_get_auth_supervisor(conn_get_account(tc),NULL)==1)  ||
          (account_get_auth_headoperator(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_operator(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_voiceoperator(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_cheatanalyzer(conn_get_account(tc),NULL)==1) ||
          (account_get_auth_teamevent(conn_get_account(tc),NULL)==1))
    {
      if ((nick = conn_get_username(tc)))
        {
          if (i+std::strlen(nick)+2>sizeof(msgtemp)) /* " ", name, '\0' */
        {
          message_send_text(c,message_type_whisper,c,msgtemp);
          i = 0;
        }
        
          std::sprintf(&msgtemp[i]," %s",nick);
          i += std::strlen(&msgtemp[i]);
        }
    }
    }
  if (i>0)
    message_send_text(c,message_type_whisper,c,msgtemp);

  return 0;
}

is incomplete

You can put all the full code please

4 (edited by Zeloit 12.05.2013 17:33)

Re: [Guide] new command to see operators who are connected online

Change "message_type_whisper" to message_type_info

it is complete code and can work,
provided that you create code "account_get_auth_headadmin, account_get_auth_developer, etc." in account_wrap.cpp and account_wrap.h
correctly in code:

extern int account_get_auth_admin(t_account * account, char const * channelname)
{
    char temp[256];

    if (!channelname)
    return account_get_boolattr(account, "BNET\\auth\\admin");

    std::sprintf(temp,"BNET\\auth\\admin\\%.100s",channelname);
    return account_get_boolattr(account, temp);
}


extern int account_set_auth_admin(t_account * account, char const * channelname, int val)
{
    char temp[256];

    if (!channelname)
    return account_set_boolattr(account, "BNET\\auth\\admin", val);

    std::sprintf(temp,"BNET\\auth\\admin\\%.100s",channelname);
    return account_set_boolattr(account, temp, val);
}

and don't forget you create code in account_wrap.h
this ex:

extern int account_get_auth_admin(t_account * account, char const * channelname);
extern int account_set_auth_admin(t_account * account, char const * channelname, int val);

Added new code account_get_auth_headadmin and account_set_auth_headadmin.
you can add new code as you like

is completely... you understand ?

Posts: 4

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 → [Guide] new command to see operators who are connected online