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