Online Xname Command [by David Endre]
Snippet Posted Wednesday, August 12th @ 11:32:45 PM, by George Greer in the Wizard dept.
. Click the link below to read it or download it.

From: David Endre <bodega@petstore.staffairs.andrews.edu>
Subject: [Circle] CODE: Char_ban command

I just wrote this code a couple of days a ago, so I could easily ban
inappropriate names online. So here you go :)

in act.wizard.c:
add these towards the top

extern FILE *player_fl;

void Read_Invalid_List(void);

then add this somewhere in the same file

ACMD(do_xname)
{
   char tempname[MAX_INPUT_LENGTH];
   int i = 0;
   FILE *fp;
   *buf = '\0';

   one_argument(argument, buf);

   if(!*buf)
      send_to_char("Xname which name?\r\n", ch);
   if(!(fp = fopen(XNAME_FILE, "a"))) {
      perror("Problems opening xname file for do_xname");
      return;
   }
   strcpy(tempname, buf);
   for (i = 0; tempname[i]; i++)
      tempname[i] = LOWER(tempname[i]);
   fprintf(fp, "%s\n", tempname);
   fclose(fp);
   sprintf(buf1, "%s has been xnamed!", tempname);
   send_to_char(buf1, ch);
   Read_Invalid_List();
}

finally in interpreter.c add:


ACMD(do_xname);
and

{ "xname"  , POS_DEAD  , do_xname, LVL_IMPL, 0 },

This is basically how mine is set up...Note that code doesn't include
very many checks and this is the main reason I only let Imps use this code.
If you decide to add on please send me your additions :)
Or if you have any problems or questions about this code mail me.


<< Online Bugfile Viewer [by Rasdan] | Reply | View as text | Flattened | Pager [by Murmix] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.