Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] The Source Code → how to show cg list

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 10

1

Topic: how to show cg list

how to make a new command like this:
/cg view <number cg>

example:
i want to see who has cg 2, so i type like this:
/cg view 2
it will show username who has cg 2:
Jimmy
Jimmy_1
Jimmy_2
etc.

/cg view 3, it will show username who has cg 3

etc.

anyone could help me ?

2

Re: how to show cg list

I can help you with MySQL query. Change "7" to cg number you want to find (from 1 to 8):

SELECT username FROM pvpgn_bnet WHERE auth_command_groups & POW(2,7)/2
Do not ask for support in PM.

3

Re: how to show cg list

i have figured how to make the command, it can be like /admins

but i can't implement the code to make command cg list

anyone, know ?

4

Re: how to show cg list

Jimmy_Aquarius wrote:

i have figured how to make the command, it can be like /admins
but i can't implement the code to make command cg list
anyone, know ?

look like done on the /cg list and remake. also use

account_get_command_groups();

5

Re: how to show cg list

Works on the principle account_get_commandgroups.  here's the code in "haste arm":

static int _handle_cgonline_command(t_connection * c, char const *text)
{
    unsigned int    i;
    t_elem const *  curr;
    t_connection *  tc;
    char const *    nick;
    t_channel *    channel;
    channel = conn_get_channel(c);
    
    std::strcpy(msgtemp, "Admins command group's:");
    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_command_groups(conn_get_account(tc)) == 255)

        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 [12345678] ", nick);
            i += std::strlen(&msgtemp[i]);
        }

        if (account_get_command_groups(conn_get_account(tc)) == 64)

        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 [1234567] ", nick);
            i += std::strlen(&msgtemp[i]);
        }
        if (account_get_command_groups(conn_get_account(tc)) == 32)

        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 [123456] ", nick);
            i += std::strlen(&msgtemp[i]);
        }
        if (account_get_command_groups(conn_get_account(tc)) == 16)

        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 [12345] ", nick);
            i += std::strlen(&msgtemp[i]);
        }
        if (account_get_command_groups(conn_get_account(tc)) == 8)

        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 [1234] ", nick);
            i += std::strlen(&msgtemp[i]);
        }
        if (account_get_command_groups(conn_get_account(tc)) == 4)

        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 [123] ", nick);
            i += std::strlen(&msgtemp[i]);
        }
        if (account_get_command_groups(conn_get_account(tc)) == 2)

        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 [12] ", nick);
            i += std::strlen(&msgtemp[i]);
        }
        else
        {
            std::sprintf(&msgtemp[i], " %s [1] ", nick);
            i += std::strlen(&msgtemp[i]);
        }
    }

    if (i>0)
        message_send_text(c, message_type_info, c, msgtemp);

    return 0;
}

6 (edited by Suite 19.02.2014 12:58)

Re: how to show cg list

^ code works if users is online.

7 (edited by Jimmy_Aquarius 19.02.2014 18:29)

Re: how to show cg list

is it possible to show the user that is not online ?

8

Re: how to show cg list

Yeah.

9

Re: how to show cg list

XOM91K wrote:

Yeah.

how to make it ?

10

Re: how to show cg list

t_account -_-

Добавлено: 21.02.2014 20:47

my code to view the vip members. make under itself:

static int _handle_listplayers_command(t_connection * c, char const *text)
{
  unsigned int    i;
  t_entry *  curr;
  t_account *  tc;
  char const *    nick;

  std::strcpy(msgtemp,"Список VIP-игроков:");
  i = std::strlen(msgtemp);
  HASHTABLE_TRAVERSE(accountlist(),curr)
    {
      tc = (t_account*)entry_get_data(curr);
      if (!tc)
    continue;
      if (account_get_auth_vip(tc)>0)
    {
      if ((nick = account_get_name(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;
}

Posts: 10

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 0 guests, 0 registered users

forums.pvpgn.pro → [EN] The Source Code → how to show cg list