ClanStat Command v1.0 What this does: This is a pretty nifty piece of code for clans. It will basically tell you all of your clans information and also display all of the current members who are logged in. Keep in mind when I made this I had to extra clan positions, Senator and Ambassador, I removed the variables from this code, but it still displays that it once was there, same goes with clan ranks... :/ Also, this is not an original idea, it is original code completely coded by Diablo. Many other MUDs will have some kind of CLANSTAT function, well SWR's anyways. What you will need to change: clans.c mud.h tables.c *Always remember to backup the files you will change incase of an error with installation, or an error with the code. cp .bak What you will need to add: Nothing at the moment, you can always add your own twists to things. ------------------------------------------------------------------------------------------------- clans.c Somewhere at the bottom of the file, add this, (hopefully it looks alright), may look a bit messy, but it will look good once you get it in. void do_clanstat( CHAR_DATA *ch , char *argument ) { PLANET_DATA *planet; CLAN_DATA *clan; long revenue = 0; int pCount = 0, support = 0; CHAR_DATA *victim; DESCRIPTOR_DATA *d; bool found; if ( IS_NPC( ch ) ) { send_to_char( "Huh?\n\r", ch ); return; } if ( !ch->pcdata || !ch->pcdata->clan ) { send_to_char( "&RYou're not even IN a clan!\n\r", ch); return; } clan = ch->pcdata->clan; for ( planet = first_planet ; planet ; planet = planet->next ) if ( clan == planet->governed_by ) { support += planet->pop_support; pCount++; revenue += get_taxes(planet); } if ( pCount > 1 ) support /= pCount; ch_printf( ch, "\n\r&B+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+\n\r" ); ch_printf( ch, "&B| &CClan Statistics for &W%-35.35s &B|\n\r", clan->name ); ch_printf( ch, "&B+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+\n\r" ); if( clan->leader[0] != 0 ) ch_printf( ch, " &B| &CLeader&B: &W%-16.16s &B| &CSpacecrafts&B: &W%-3d &B|\n\r", clan->leader, clan->spacecraft ); else ch_printf( ch, " &B| &CLeader&B: &WNone &B| &CSpacecrafts&B: &W%-3d &B|\n\r", clan->spacecraft ); if( clan->number1[0] != 0 ) ch_printf( ch, " &B| &CFirst &B: &W%-16.16s &B| &CMembers&B: &W%-3d &B|\n\r", clan->number1, clan->members ); else ch_printf( ch, " &B| &CFirst &B: &WNone &B| &CMembers&B: &W%-3d &B|\n\r", clan->members ); if( clan->number2[0] != 0 ) ch_printf( ch, " &B| &CSecond&B: &W%-16.16s &B| &CVehicles&B: &W%-3d &B|\n\r", clan->number2, clan->vehicles ); else ch_printf( ch, " &B| &CSecond&B: &WNone &B| &CVehicles&B: &W%-3d &B|\n\r", clan->vehicles ); ch_printf( ch, " &B| &CFunds&B: &Y%-10d &B| &CAmbassador&B: &WNone &B|\n\r", clan->funds ); ch_printf( ch, " &B| &CPlanets&B: &W%-2d &B| &CSenator&B: &WNone &B|\n\r", pCount ); &B|\n\r", pCount ); ch_printf( ch, " &B| &CAvg. Support&B: &W%-3d &B| &CRevenue&B: &O%-8d &B|\n\r", support, revenue ); ch_printf( ch, " &B+--------------------------+----------------------------+\n\r" ); ch_printf( ch, " &B| &CPKills&B: &G%-3d &B|\n\r", clan->pkills ); ch_printf( ch, " &B| &CMKills&B: &c%-5d &B|", clan->mkills ); ch_printf( ch, " &B| &CPDeaths&B: &R%-3d &B|\n\r", clan->pdeaths ); ch_printf( ch, " &B+--------------------------+\n\r" ); send_to_char( "&CCurrent logged in members&B:&W\n\r", ch ); found = FALSE; for ( d = first_descriptor; d; d = d->next ) if ( (d->connected == CON_PLAYING ) && ( victim = d->character ) != NULL && !IS_NPC(victim) && ( victim->pcdata->clan ) != NULL && ( victim->pcdata->clan->name == ch->pcdata->clan->name ) ) { found = TRUE; pager_printf( ch, " &W%-15s&B&W%s\n\r", victim->name, victim->pcdata->clan->leader == victim->name ? " &B[&CLeader&B]&W" : victim->pcdata->clan->number1 == victim->name ? " &B[&CFirst&B]&W" : victim->pcdata->clan->number2 == victim->name ? " &B[&CSecond&B]&W " : "" ); } if ( !found ) send_to_char( "None.\n\r", ch ); ch_printf( ch, "&B+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+\n\r" ); ch_printf( ch, "&B| |\n\r" ); ch_printf( ch, "&B+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+&z&W\n\r" ); return; } ------------------------------------------------------------------------------------------------- mud.h Find, DECLARE_DO_FUN( do_clans ); Below it add, DECLARE_DO_FUN( do_clanstat ); ------------------------------------------------------------------------------------------------- tables.c Find, if ( !str_cmp( name, "do_clans" )) return do_clans; Below it add, if ( !str_cmp( name, "do_clanstat" )) return do_clanstat; Find, if ( skill == do_clans ) return "do_clans"; Below it add, if ( skill == do_clanstat ) return "do_clanstat"; ------------------------------------------------------------------------------------------------- make clean make copyover/reboot your mud cedit clanstat create cedit clanstat level 1 cedit save Any problems please contact me at the provided email address, -,,,.,,,,- _'Diablo'_ Star Wars Development '''''' [*]------------------------------------------------[*] ||| If you have any problems please contact me at: ||| ||| crazy_mike_316@hotmail.com ||| [*]------------------------------------------------[*]