Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] The Source Code → [ help ] how to use clanmember status on command

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 4

1 (edited by vallcerealz 23.12.2015 14:29)

Topic: [ help ] how to use clanmember status on command

Hello harpywar,
how to use edit status clanmember on command
I want to create a multi chieftain with the command and change the clan members into a database ( status, 4 )

such as :
/clan chieftain <nick> - Example : /clan chieftain harpywar

I 've tried to copy motd command in the clan , but it does not work on clan members

( status, 1 ) - This is for set member to status peon
( status, 2 ) - This is for set member to status grunt
( status, 3 ) - This is for set member to status shaman
( status, 4 ) - This is for set member to status chieftain


[command.cpp]

else if (clanmember_get_status(member)==CLAN_CHIEFTAIN) {
          if (strstart(text,"chieftain")==0) {
                   const char * text = skip_command(text);
                   clan=clanmember_get_clan(member);
                   if ( text[0] == '\0' ) {
                    message_send_text(c,message_type_info,c,"/clan change <channel name> - Change your clan channel");
                    return 0;
                       }
                   if ( clan_set_chieftain( clan,text)<0 )
                    message_send_text(c,message_type_error,c,"Failed to change clan channel");
                    else
                    message_send_text(c,message_type_info,c,"Change Clan Channel Sucsessfully");
             }
           }
[clan.cpp]

extern int clan_set_chieftain(t_clan * clan, char const *text)
{
    t_list * cl_member_list;
    t_elem * curr;
    t_clanmember * member;
    t_account * account;
    if (!clan) {
        eventlog(eventlog_level_error, __FUNCTION__, "got NULL clan");
        return -1;
    }
    cl_member_list = clan_get_members(clan);
    LIST_TRAVERSE(cl_member_list,curr) {
        if (!(member = (t_clanmember*)elem_get_data(curr))) {
            eventlog(eventlog_level_error,__FUNCTION__,"found NULL entry in list");
            continue;
        }
        if ( clanmember_get_status(member) == CLAN_CHIEFTAIN ) {
            account= clanmember_get_account( member );
          if ( account_set_strattr(account,"status", text) ) {
           return 1;
        }
      }
    }
 return 0;
}
[clan.h]

extern int clan_set_chieftain(t_clan * clan, const char *channel);

Thanks,
SUNDAWANI

2

Re: [ help ] how to use clanmember status on command

As far as I understand you need to save multiple chieftain account names in "status" field (for instance: "harpywar,vallceralz")
To read this field you have to parse it into array in all usages of your chieftain code. So google to c split example and try code it yourself.

Do not ask for support in PM.

3

Re: [ help ] how to use clanmember status on command

HarpyWar wrote:

As far as I understand you need to save multiple chieftain account names in "status" field (for instance: "harpywar,vallceralz")
To read this field you have to parse it into array in all usages of your chieftain code. So google to c split example and try code it yourself.

Thanks harpywar, i'll try again for multiple chieftain  wink

4

Re: [ help ] how to use clanmember status on command

for your information

if (strstart(text,"peon")==0 || strstart(text,"grunt")==0 || strstart(text,"shaman")==0 || strstart(text,"chieftain")==0) {
       if ( clanmember_get_status(member) != CLAN_CHIEFTAIN  {
          message_send_text(c,message_type_info,c,"Only Chieftain Command");
          return 0;
          }
         char const * botcmd=skip_command(text);
          member = clan_find_member_by_name(clan,botcmd);

       if ( botcmd[0] == '\0' ) {
          message_send_text(c,message_type_info,c,"Usage:");
          message_send_text(c,message_type_info,c,"/clan peon <id>");
          message_send_text(c,message_type_info,c,"/clan grunt <id>");
          message_send_text(c,message_type_info,c,"/clan shaman <id>");
          return 0;
          }
      if (strstart(text,"peon")==0) {
       if (clanmember_set_status(member,CLAN_PEON)<0) {
          message_send_text(c,message_type_error,c,"Set Peon Failed");
          return 0;
          }
         }
      else if (strstart(text,"grunt")==0) {
       if (clanmember_set_status(member,CLAN_GRUNT)<0) {
          message_send_text(c,message_type_error,c,"Set grunt Failed");
          return 0;
         }
        }
      else if (strstart(text,"shaman")==0) {
       if (clanmember_set_status(member,CLAN_SHAMAN)<0) {
          message_send_text(c,message_type_error,c,"Set shaman Failed");
          return 0;
         }
        }
      else if (strstart(text,"chieftain")==0) {
       if (clanmember_set_status(member,CLAN_CHIEFTAIN)<0) {
          message_send_text(c,message_type_error,c,"Set chieftain Failed");
          return 0;
         }
        }
     snprintf(msgtemp, sizeof(msgtemp),"Set %s Success",text);
        message_send_text(c,message_type_info,c,msgtemp);
       }

by Sikimat

Posts: 4

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 → [ help ] how to use clanmember status on command