Topic: /clan create "help please"
I could correct the code please
else if (acc &&(strstart(text,"create")==0 || strstart(text,"c")==0))
{
t_packet * rpacket;
t_connection * dest_c;
t_account * friend_acc,*account;
t_server_friendslistreply_status status;
t_game * game;
t_channel * channel;
char stat;
t_clanmember *member;
int i,j;
char const *tag,*clanname, *mem[4];
int created, clantag;
t_clan *clan;
const int CLANMEM=4;
tag = skip_command(text);
clanname = skip_command(tag);
mem[0]=skip_command(clanname);
mem[1]=skip_command(mem[0]);
mem[2]=skip_command(mem[1]);
mem[3]=skip_command(mem[2]);
if (tag[0] == '\0' || clanname[0] == '\0')
{
message_send_text(c,message_type_info,c,"usage: /c create <Nick clan> <Canal clan> <ID-1> <ID-2> <ID-3> <ID-4>");
return 0;
}
for(i=0;i<CLANMEM;i++)
{
if(mem[i][0] ==0)
{
message_send_text(c,message_type_info,c,"usage: /c create <Nick clan> <Canal clan> <ID-1> <ID-2> <ID-3> <ID-4>");
return 0;
}
}
if(strlen(tag)!=4)
{
message_send_text(c,message_type_error,c,"Clan Nick es una palabra de cuatro letras con las letras y los números");
return 0;
}
for(i=0;i<4;i++)
{
j=0;
if(tag[i]>='a'&&tag[i]<='z')
j=1;
if(!j&&tag[i]>='A'&&tag[i]<='Z')
j=1;
if(!j&&tag[i]>='0'&&tag[i]<='9')
j=1;
if(j==0)break;
}
if(i!=4)
{
message_send_text(c,message_type_error,c,"Clan Nick es una palabra de cuatro letras con las letras y los números");
return 0;
}
clantag=str_to_clantag(tag);
if(clanlist_find_clan_by_clantag(clantag)!=NULL)
{
message_send_text(c,message_type_error,c,"Nick Del clan que ya existe.");
return 0;
}
if(clanlist_find_clan_by_clanname(clanname)!=NULL)
{
message_send_text(c,message_type_error,c,"Canal Del Clan ya está presente.");
return 0;
}
if ((account = conn_get_account(c)) && (account_get_clan(account) != NULL))
{
message_send_text(c,message_type_error,c,"Es un miembro de este clan.");
return 0;
}
for (i=0;i<CLANMEM;i++)
{
if (!(friend_acc = accountlist_find_account(mem[i]))) {
sprintf(msgtemp,"%dUna segunda entrada %s El usuario no existe",i+1,mem[i]);
message_send_text(c,message_type_error,c,msgtemp);
return 0;
}
if(conn_get_account(c)==friend_acc)
{
message_send_text(c,message_type_error,c,"Mismos no pueden registrarse como miembro del Clan");
return 0;
}
if(account_get_numattr(friend_acc,"BNET\\joinclan")!=clantag)
{
sprintf(msgtemp, "%sNo estaba de acuerdo con. (¿ aceptar : /clan join Nick clan)", mem[i]);
message_send_text(c,message_type_error,c,msgtemp);
return 0;
}
for(j=i+1;j<CLANMEM;j++)
{
if(0==strcasecmp(mem[i],mem[j]))
{
message_send_text(c,message_type_error,c,"Existe Duplicado ID.");
return 0;
}
}
}
if(clanlist_find_clan_by_clantag(clantag)!=NULL)
{
message_send_text(c,message_type_error,c,"Nick de clan que ya existe.");
return 0;
}
if (!(clan = clan_create(account, clantag, clanname, NULL))) {
message_send_text(c,message_type_error,c,"Clan del error generado(1)");
return 0;
}
if (clanlist_add_clan(clan)==-1) {
message_send_text(c,message_type_error,c,"Clan del error generado(2)");
return 0;
}
clan_set_created(clan,120);
//clanlog(clan_get_clantag(clan),"CI",clanname,0);
//clanlog(clan_get_clantag(clan),"MI",account_get_name(acc),1);
for (i=0;i<CLANMEM;i++)
{
clan_add_member(clan, accountlist_find_account(mem[i]), CLAN_NEW);
//clanlog(clan_get_clantag(clan),"MI",mem[i],0);
}
message_send_text(c,message_type_info,c,"Clan ha sido creado.");
return 0;
}
errror if(clanlist_find_clan_by_clanname(clanname)!=NULL) identifier not found