Disallow mob names for players [by Dez]
Snippet Posted Wednesday, August 12th @ 11:26:11 PM, by George Greer in the Utils dept.
Added Dec 7, 1996. Click the link below to read it or download it.

From: Desmond Daignault <tekdd@dtol.datatimes.com>
Subject: Invalid Player Names

If you want to stop those nasty players that like to login to the mud with
the name of a mob (inorder to have other players to attack him), you might
want to add the following piece of code inside the Valid_Name function in
ban.c...

/******* Add this after the #defines ********/
extern int top_of_mobt;
extern struct char_data *mob_proto;
/*******************************************/


int Valid_Name(char *newname)
{
  int i;

  char tempname[MAX_NAME_LENGTH];

  /* return valid if list doesn't exist */
  if (!invalid_list || num_invalid < 1)
    return 1;

  /* change to lowercase */
  strcpy(tempname, newname);
  for (i = 0; tempname[i]; i++)
    tempname[i] = LOWER(tempname[i]);

  /* Does the desired name contain a string in the invalid list? */
  for (i = 0; i < num_invalid; i++)
    if (strstr(tempname, invalid_list[i]))
      return 0;

/********  Add this  **********/
  for (i = 0; i < top_of_mobt; i++) {
    if (isname(tempname, mob_proto[i].player.name))
      return 0;
  }
/*****************************/

  return 1;
}



<< Dig and Bury Command [by Chris Ryan] | Reply | View as text | Flattened | Disintegrate Spell [by Franco] >>

 


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.